Open its-dibo opened 1 year ago
I think --silent
works as intended in your example. All this flag does is it tells shx to suppress error output, and that's what happened (shx did not print the error message).
The Lifecycle script
error message is printed by npm because shx
returned a non-zero status code. So if you want to suppress all the error output, I recommend you do as I advised in #210.
I think we could clarify this a bit better in the README documentation by adding a couple examples:
...
$ shx --silent ls fakeFileName # silence error output
# Add this part:
$ shx --silent ls fakeFileName || shx true # silence error output and ignore the exit status
and also add
{
"scripts": {
"clean": "shx rm -rf build dist && shx echo Done",
"copy-suppress-errors": "shx --silent cp some_file.txt destination/ && shx true"
}
}
[docs] to be more clear:
--silent
suppress the original error but exits with code 1, to ignore the error either use --ignore
(if supported) or use shx invalid-cmd || true
the following example is from readme.md
output: