ZheNing Hu <adlternative@xxxxxxxxx> writes: > But when I am reproducing your solution, I may be in trouble: > If we let shell-script `exit(1)`, `capture_command()` will output > "running trailer command '%s' failed" which is its origin strategy > in order to catch the user's command error. Yes, if we were to take that route, the trailer.c code needs to be taught to conditionally not to pass $1, and capture_command() needs to be taught to conditionally be silent on non-zero exit, as it now is a perfectly sane for the program to exit with non-zero status in some cases (like this one).