Open jeffrson opened 2 years ago
Hi! π
This issue looks stale, and doesn't feature the reproducible
label - which implies that you didn't provide a working reproduction using Sherlock. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it or you edit your first post to include a formal reproduction (you can use the playground for that).
Note that we require Sherlock reproductions for long-lived issues (rather than standalone git repositories or similar) because we're a small team. Sherlock gives us the ability to check which bugs are still affecting the master branch at any given point, and decreases the amount of code we need to run on our own machines (thus leading to faster bug resolutions). It helps us help you! π
If you absolutely cannot reproduce a bug on Sherlock (for example because it's a Windows-only issue), a maintainer will have to manually add the upholded
label. Thanks for helping us triaging our repository! π
I can reproduce this.
Use this package.json
{
"scripts": {
"stdout-and-stderr": "(echo out; type stderr) 1>/dev/null 2>&1"
}
}
Now try running this script with different package runners:
$ npm run stdout-and-stderr
> PageBank@1.0.0 stdout-and-stderr
> (echo out; type stderr) 1>/dev/null 2>&1
$ bun run stdout-and-stderr
$ (echo out; type stderr) 1>/dev/null 2>&1
error: script "stdout-and-stderr" exited with code 1
$ deno task stdout-and-stderr
Task stdout-and-stderr (echo out; type stderr) 1>/dev/null 2>&1
error: Error parsing script 'stdout-and-stderr'.
Caused by:
Multiple redirects are currently not supported.
1>/dev/null 2>&1
~
$ yarn stdout-and-stderr
/usr/bin/type: line 4: type: stderr: not found
You can see that yarn
does not respect the 2>&1
. However, if I change the script to
"stdout-and-stderr": "(echo out; type stderr) 1>/dev/null 2>/dev/null"
It works correctly
$ yarn stdout-and-stderr
Self-service
Describe the bug
@yarnpkg/shell supports redirection of stdout and stderr: "command > stdout.txt 2> stderr.txt"
Apparently, combining those into one stream is also implemented. However, it does not work as intended. Given this "command > stdout.txt 2>&1" it should be expected, that both standard output and standard error are written to stdout.txt. However, standard error is not redirected, but written to "real" standard out of process. A bit of a mess...
To reproduce
Environment
Additional context
No response