From 7e6753609d102b68a625072fb1660065246a54e2 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 28 Oct 2016 21:57:31 +0200 Subject: hush: fix "wait PID" It was not properly interruptible, and did not update job status (the exited processes were still thought of as running). function old new delta process_wait_result - 453 +453 wait_for_child_or_signal - 199 +199 run_list 996 1002 +6 checkjobs_and_fg_shell 41 43 +2 builtin_wait 328 215 -113 checkjobs 516 142 -374 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 2/2 up/down: 660/-487) Total: 173 bytes Signed-off-by: Denys Vlasenko --- shell/hush_test/hush-misc/wait1.right | 2 ++ shell/hush_test/hush-misc/wait1.tests | 3 +++ shell/hush_test/hush-misc/wait2.right | 2 ++ shell/hush_test/hush-misc/wait2.tests | 4 ++++ shell/hush_test/hush-misc/wait3.right | 2 ++ shell/hush_test/hush-misc/wait3.tests | 3 +++ 6 files changed, 16 insertions(+) create mode 100644 shell/hush_test/hush-misc/wait1.right create mode 100755 shell/hush_test/hush-misc/wait1.tests create mode 100644 shell/hush_test/hush-misc/wait2.right create mode 100755 shell/hush_test/hush-misc/wait2.tests create mode 100644 shell/hush_test/hush-misc/wait3.right create mode 100755 shell/hush_test/hush-misc/wait3.tests (limited to 'shell/hush_test/hush-misc') diff --git a/shell/hush_test/hush-misc/wait1.right b/shell/hush_test/hush-misc/wait1.right new file mode 100644 index 000000000..20f514da0 --- /dev/null +++ b/shell/hush_test/hush-misc/wait1.right @@ -0,0 +1,2 @@ +0 +[1] Running sleep 2 diff --git a/shell/hush_test/hush-misc/wait1.tests b/shell/hush_test/hush-misc/wait1.tests new file mode 100755 index 000000000..f9cf6d48c --- /dev/null +++ b/shell/hush_test/hush-misc/wait1.tests @@ -0,0 +1,3 @@ +sleep 2 & sleep 1 & wait $! +echo $? +jobs diff --git a/shell/hush_test/hush-misc/wait2.right b/shell/hush_test/hush-misc/wait2.right new file mode 100644 index 000000000..f018c2c98 --- /dev/null +++ b/shell/hush_test/hush-misc/wait2.right @@ -0,0 +1,2 @@ +0 +[1] Running sleep 3 diff --git a/shell/hush_test/hush-misc/wait2.tests b/shell/hush_test/hush-misc/wait2.tests new file mode 100755 index 000000000..be20f95a5 --- /dev/null +++ b/shell/hush_test/hush-misc/wait2.tests @@ -0,0 +1,4 @@ +sleep 3 & sleep 2 & sleep 1 +wait $! +echo $? +jobs diff --git a/shell/hush_test/hush-misc/wait3.right b/shell/hush_test/hush-misc/wait3.right new file mode 100644 index 000000000..5437b1d73 --- /dev/null +++ b/shell/hush_test/hush-misc/wait3.right @@ -0,0 +1,2 @@ +3 +[1] Running sleep 2 diff --git a/shell/hush_test/hush-misc/wait3.tests b/shell/hush_test/hush-misc/wait3.tests new file mode 100755 index 000000000..ac541c3fc --- /dev/null +++ b/shell/hush_test/hush-misc/wait3.tests @@ -0,0 +1,3 @@ +sleep 2 & (sleep 1;exit 3) & wait $! +echo $? +jobs -- cgit v1.2.3