Skip to content

Conversation

@simonplend
Copy link
Contributor

There are a variety of scenarios in which npm ls will return a non-zero exit code and the output will include error messages. In order to aid with debugging it is useful to be able to see these error messages. The changes introduced in PR #105 had the effect of silencing errors completely.

This change ensures that if the npm ls command was successful, but the output contains some lines that aren't filepaths e.g. loglevel info output, they will be stripped out, but that in the case of npm ls returning an error, you will be able to see it in the output displayed by shellpromise.

There are a variety of scenarios in which `npm ls` will return
a non-zero exit code and the output will include error messages.
In order to aid with debugging it is useful to be able to see
these error messages. The changes introduced in PR #105 had the
effect of silencing errors completely.

This change ensures that if the `npm ls` command was successful,
but the output contains some lines that aren't filepaths e.g.
loglevel info output, they will be stripped out, but that in the
case of `npm ls` returning an error, you will be able to see it
in the output displayed by `shellpromise`.
@simonplend
Copy link
Contributor Author

I wasn't sure of a good way to add a test for this. Suggestions welcome!

@bjfletcher
Copy link
Contributor

this may interest you matthew-andrews/shellpromise#8

@Limess
Copy link

Limess commented Jul 31, 2018

https://github.com/sindresorhus/execa is also much more configurable in this regard, returning a promise with {stderr, stdout} (among other interfaces).

@matthew-andrews matthew-andrews merged commit 4bf9088 into matthew-andrews:master Aug 3, 2018
@simonplend simonplend deleted the display-npm-ls-errors branch August 3, 2018 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants