diff options
-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; } |