diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-07-03 15:40:40 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-07-03 15:44:29 +0200 |
commit | 8fa2e549cbf181a7552ac8833c1aec56d80c335b (patch) | |
tree | 968b9b8e82ffbdee3a80451a3d7702fe41195abd | |
parent | 9b344820c4b8897156379e9b457a4301544eca80 (diff) | |
download | xe-8fa2e549cbf181a7552ac8833c1aec56d80c335b.tar.gz xe-8fa2e549cbf181a7552ac8833c1aec56d80c335b.tar.xz xe-8fa2e549cbf181a7552ac8833c1aec56d80c335b.zip |
add -vv to trace pid and exit status
-rw-r--r-- | xe.1 | 1 | ||||
-rw-r--r-- | xe.c | 16 |
2 files changed, 14 insertions, 3 deletions
diff --git a/xe.1 b/xe.1 index 2b2e642..1e0d7d1 100644 --- a/xe.1 +++ b/xe.1 @@ -93,6 +93,7 @@ never executes a command when no arguments are passed. Dry run: don't run the commands, just print them. .It Fl v Verbose: print commands to standard error before running them. +When used twice, also print PID and exit status for each command. .It Fl I Ar arg Replace occurrences of .Ar arg diff --git a/xe.c b/xe.c index 946ec5a..7e2a468 100644 --- a/xe.c +++ b/xe.c @@ -104,6 +104,11 @@ mywait() pid, WTERMSIG(status)); exit(125); } + + if (vflag > 1) { + fprintf(traceout, "%ld< %d\n", (long)pid, WEXITSTATUS(status)); + fflush(traceout); + } runjobs--; return 1; @@ -142,6 +147,7 @@ trace() shquote(args[i]); } fprintf(traceout, "\n"); + fflush(traceout); return 0; } @@ -194,10 +200,8 @@ run() scanargs(); - if (vflag || nflag) - trace(); - if (nflag) { + trace(); runjobs--; return 0; } @@ -224,6 +228,12 @@ run() if (pid < 0) exit(126); + if (vflag) { + if (vflag > 1) + fprintf(traceout, "%ld> ", (long)pid); + trace(); + } + return 0; } |