You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I'm running a command with .quiet() or .stdout("piped").stderr("piped") and it fails, I just get an error like this:
error: Uncaught (in promise) Error: Exited with code: 1
throw new Error(`Exited with code: ${code}`);
This makes it a bit of a pain to debug commands that start to fail for some reason.
I'm about to write a function for myself to
run the command with .noThrow()
check its result.
If the result != 0, print out its stdout/stderr
Then throw an error about the return code.
But it would be nice if this were built-in!
My preference would be for this to be on by default in cases where stderr/stdout are being suppressed. But that might have performance implications for .quiet() which I'm guessing just sends outputs to /dev/null. So maybe opt-in? .debugThrow()? showThrow()?
The text was updated successfully, but these errors were encountered:
I'm not sure at the moment that another method should be added for this that's built in because I think how it should be handled is probably specific to the scenario. For example, the output of stderr might be quite large or the script might only show useful information on stdout for some reason. Also, since the output is piped, it might have been consumed by something else already.
Perhaps when the error is thrown it should also include the CommandChild and using that error someone could get the output on failure. Overall, it's a good suggestion, but it might be good to sit on this one for a bit.
If I'm running a command with
.quiet()
or.stdout("piped").stderr("piped")
and it fails, I just get an error like this:This makes it a bit of a pain to debug commands that start to fail for some reason.
I'm about to write a function for myself to
.noThrow()
But it would be nice if this were built-in!
My preference would be for this to be on by default in cases where stderr/stdout are being suppressed. But that might have performance implications for
.quiet()
which I'm guessing just sends outputs to /dev/null. So maybe opt-in?.debugThrow()
?showThrow()
?The text was updated successfully, but these errors were encountered: