Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/utils/dlx.mts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ import { spawn } from '@socketsecurity/registry/lib/spawn'

import { getDefaultOrgSlug } from '../commands/ci/fetch-default-org-slug.mts'
import constants, {
CI,
FLAG_QUIET,
FLAG_SILENT,
NPM,
PNPM,
VITEST,
YARN,
} from '../constants.mts'
import { getErrorCause } from './errors.mts'
Expand Down Expand Up @@ -275,9 +277,30 @@ export async function spawnCoanaDlx(
spawnExtra,
)
const output = await result.spawnPromise
// Print output when running in e2e-tests workflow for debugging.
// Respect the silent option from the caller.
if (CI && VITEST && !dlxOptions.silent) {
if (output.stdout) {
console.log(output.stdout)
}
if (output.stderr) {
console.error(output.stderr)
}
}
return { ok: true, data: output.stdout }
} catch (e) {
const stdout = (e as any)?.stdout
const stderr = (e as any)?.stderr
// Print output when running in e2e-tests workflow for debugging.
// Respect the silent option from the caller.
if (CI && VITEST && !dlxOptions.silent) {
if (stdout) {
console.log(stdout)
}
if (stderr) {
console.error(stderr)
}
}
const cause = getErrorCause(e)
const message = stderr || cause
return {
Expand Down
Loading