stderr is always sent to stdout unless failOnStdErr is true
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
A processes stderr is always sent to stdout instead of stderr unless the failOnStdErr option is set.
I want to silence stdout while keeping stderr. I tried to do this with this line:
const output = await getExecOutput('my-command', ['my-args'], {
outStream: nullStream,
errStream: process.stderr, // alternatively without this line
})
however, this unexpectedly silences both stdout and stderr.
Also setting the failOnStdErr option to true fixes the above problem, but also throws an error if the command prints to stderr, even when returning with a 0 exit code.
To Reproduce
Steps to reproduce the behavior:
- Run this in a GitHub Action:
const nullStream = new stream.Writable({
write(chunk: never, encoding: never, callback: never) {}
})
await exec('bash', ['-c', 'echo test 1>&2'], {
outStream: nullStream,
})
- Observe stdout and stderr
Expected behavior
The program should output 'test' to stderr
Actual behavior
There is no output
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the getExecOutput and exec stream-handling entry points, then reproduce the issue with the provided bash command and custom nullStream. Done means stdout can be suppressed while stderr remains visible, without requiring failOnStdErr or throwing for a successful command that writes to stderr.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100