hush: make "wait %1" work even if the job is dead
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 14 Jul 2017 17:58:46 +0000 (19:58 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 14 Jul 2017 17:58:46 +0000 (19:58 +0200)
commit2ed74e25d354e6958dc86a21aa32c2dacb809bf0
tree4fd9ec08db321fa8c771dc2b0c7de4efb1324d83
parent0c5657e9119eb52263e83e9b55394a8f43f4e928
hush: make "wait %1" work even if the job is dead

Example script:

sleep 1 | (sleep 1;exit 3) &
sleep 2
echo Zero:$?
wait %1
echo Three:$?

function                                             old     new   delta
clean_up_last_dead_job                                 -      24     +24
process_wait_result                                  426     447     +21
builtin_wait                                         285     293      +8
insert_job_into_table                                264     269      +5
builtin_jobs                                          68      73      +5
remove_job_from_table                                 59      57      -2
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/1 up/down: 63/-2)              Total: 61 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/hush.c