stderr output is ignored if a `run` script does not fail
See original GitHub issueTasks that succeed or tasks that fail with --no-bail
enabled simply discard stderr
output. This output is important and discarding it can make figuring out what is happening in running tasks very difficult.
https://github.com/lerna/lerna/blob/master/commands/run/index.js#L167
Expected Behavior
stderr
is reported for successful tasks.
Current Behavior
stderr
is only logged if a task fails.
Possible Solution
Always log stderr
in the above linked method.
Steps to Reproduce (for bugs)
- Create an npm script
test
that logs to stdout and stderr while returning a 0 exit code lerna run test
- Notice that
stderr
is not output
Your Environment
Executable | Version |
---|---|
lerna --version |
3.15.0 |
node --version |
v10.13.0 |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Ignore error when stderr contains a certain message
1 Answer 1 · The lines from STDERR are held till the end of the command and spat out all at once, so...
Read more >suppress stderr messages in a bash script
But the program could be written to ignore the failure and carry on without reporting it; then you'd never know. But if your...
Read more >TIP 267: Allow 'exec' to Ignore Stderr
Currently the exec command will always fail if the process writes to standard error. Since various applications use stderr for debug output ......
Read more >How to redirect shell command output | Enable Sysadmin
Types of output · STDOUT: The normal output from a command/script (file descriptor 1) · STDERR: The error output from a command/script (file ......
Read more >Invoke a System Command - R
What happens to stdout and stderr when not captured depends on how R is running: Windows batch commands behave like a Unix-alike, but...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The change in the linked PR is strictly to the batched mode. I agree it doesn’t mean it’s an error, but frequently it contains useful information (at least in my repo) and the lack of it makes it really hard to debug when I run scripts across my 50+ packages.
The biggest failure mode for me is when I want to run all of the tests in my repo and then review all the failures (common after a big framework change). Then I’ll use
lerna run test --no-bail
so that I don’t have to runlerna run test
over and over again. However, all of the useful errors are sent tostderr
, which is then dropped when--no-bail
is present.Messages sent to
stderr
does not mean the process encountered an error. That’s whatprocess.exitCode
/process.exit(code)
is for.Well-behaved CLI programs emit logging to
stderr
, which is generally extremely noisy and can become almost worthless in a parallel execution that lerna often creates.If you want this situation, it seems like you’re really looking for
--stream
(add--concurrency 1 --no-prefix
to reduce the interleaving, maybe).