summary refs log tree commit diff
path: root/src/jobs.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-06-20 13:45:29 -0400
committerJune McEnroe <june@causal.agency>2021-06-20 13:45:29 -0400
commit005bf4e445b2431518a4e636788471c4df390aca (patch)
treec25a5730f3ae920373171924ca2a5f5aba3537e1 /src/jobs.c
parentSquashed 'bin/dash/' content from commit a45870f (diff)
downloadsrc-005bf4e445b2431518a4e636788471c4df390aca.tar.gz
src-005bf4e445b2431518a4e636788471c4df390aca.zip
Squashed 'bin/dash/' changes from a45870f7..efc7765b
efc7765b Release 0.5.11.4.
a5316982 eval: Do not cache value of eflag in evaltree
9e0f6a77 Release 0.5.11.3.
5f770b12 jobs: Only block in waitcmd on first run

git-subtree-dir: bin/dash
git-subtree-split: efc7765b5d7a4dcd23dbf8fbde35a843f5f222ca
Diffstat (limited to '')
-rw-r--r--src/jobs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/jobs.c b/src/jobs.c
index d4c13c0f..f30313be 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -81,6 +81,7 @@
 #define DOWAIT_NONBLOCK 0
 #define DOWAIT_BLOCK 1
 #define DOWAIT_WAITCMD 2
+#define DOWAIT_WAITCMD_ALL 4
 
 /* array of jobs */
 static struct job *jobtab;
@@ -615,7 +616,7 @@ waitcmd(int argc, char **argv)
 				jp->waited = 1;
 				jp = jp->prev_job;
 			}
-			if (!dowait(DOWAIT_WAITCMD, 0))
+			if (!dowait(DOWAIT_WAITCMD_ALL, 0))
 				goto sigout;
 		}
 	}
@@ -1139,6 +1140,7 @@ static int dowait(int block, struct job *jp)
 		pid = waitone(block, jp);
 		rpid &= !!pid;
 
+		block &= ~DOWAIT_WAITCMD_ALL;
 		if (!pid || (jp && jp->state != JOBRUNNING))
 			block = DOWAIT_NONBLOCK;
 	} while (pid >= 0);