rust-shell-script / rust_cmd_lib

Common rust command-line macros and utilities, to write shell-script like tasks in a clean, natural and rusty way
https://docs.rs/cmd_lib/
Apache License 2.0
1.04k stars 35 forks source link

Behavior of semi-colon in macros is confusing #59

Open michaeleisel opened 8 months ago

michaeleisel commented 8 months ago

In a shell script, a semi-colon indicates that the next command should run regardless of if the preceding command succeeds. However, in run_cmd!, a semi-colon behaves like && instead. Ideally, both && and ; would be supported and behave like they do in a shell command, or if that's not possible, the README would make it extra clear how it differs.

tao-guo commented 8 months ago

You can consider this library is doing set -euo pipefail for your script to try to catch all the errors, without introducing other pitfalls. Yeah, I can try to update the README a little bit more.