question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

stderr output is ignored if a `run` script does not fail

See original GitHub issue

Tasks 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)

  1. Create an npm script test that logs to stdout and stderr while returning a 0 exit code
  2. lerna run test
  3. Notice that stderr is not output

Your Environment

Executable Version
lerna --version 3.15.0
node --version v10.13.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
nomcoptercommented, Jul 26, 2019

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 run lerna run test over and over again. However, all of the useful errors are sent to stderr, which is then dropped when --no-bail is present.

3reactions
evocateurcommented, Jul 26, 2019

Messages sent to stderr does not mean the process encountered an error. That’s what process.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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found