← Commit list

26ad94bed

Denys Vlasenko
Denys Vlasenko
2016-11-07
SUCCESS Duration: 234s

Subject

hush: "wait $!; echo $?" should return 127 if $! already exited

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

shell/hush.c+5 -4
@@ -9636,12 +9636,13 @@ static int FAST_FUNC builtin_wait(char **argv)
/* "wait $!" but last bg task has already exited. Try:
* (sleep 1; exit 3) & sleep 2; echo $?; wait $!; echo $?
* In bash it prints exitcode 0, then 3.
+ * In dash, it is 127.
*/
- ret = 0; /* FIXME */
- continue;
+ /* ret = G.last_bg_pid_exitstatus - FIXME */
+ } else {
+ /* Example: "wait 1". mimic bash message */
+ bb_error_msg("wait: pid %d is not a child of this shell", (int)pid);
}
- /* Example: "wait 1". mimic bash message */
- bb_error_msg("wait: pid %d is not a child of this shell", (int)pid);
} else {
/* ??? */
bb_perror_msg("wait %s", *argv);