Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display any errors returned by npm ls --production --parseable #109

Merged
merged 1 commit into from
Aug 3, 2018
Merged

Display any errors returned by npm ls --production --parseable #109

merged 1 commit into from
Aug 3, 2018

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