-
-
Notifications
You must be signed in to change notification settings - Fork 236
Improved verbose
option
#751
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
Comments
👍 |
There is another use case: when running a Node.js script, users might want to see its progress. As opposed to debugging, they would then want to see the commands as they start/complete, but not necessarily their output. There is an issue on zx with 8 thumbs up that requests this. Based on this, I think we might want to turn the
One important bit is that printing output should not change the behavior otherwise. So users can turn on/off full verbose mode and their script should behave the same except for the additional debugging output. |
Proposal
When
verbose: true
is used, we should also print the command'sstdout
/stderr
.Details
The
verbose
option prints commands before executing them. The main use case is debugging.Most of the times, when users want to debug a command, they want to see the output too.
We can do this in a way that does not change the command's behavior thanks to the recent additions to the
std*
options.Alternatives
Without this, users would just
console.log(result.stdout, result.stderr)
instead. However, this has some shortcomings:result.all
instead to get interleaved outputAlternatively, users might use
stdout: 'inherit'
. However, this has the following problems:stdout
/stderr
returning objects, due to transforms inobjectMode
stdio: 'inherit'
instead would change the command's behavior by makingstdin
interactiveIn other words, getting this right is actually trickier than it looks.
In production, developers tend to use complex commands with weird setups, which can take hours to debug. When it comes to making command execution easier, improving debugging is a major way we can help out our users.
The text was updated successfully, but these errors were encountered: