fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
99d63c21f
master
1# RUN: %fish %s 2 3# Ensure that we can wait for stuff. 4status job-control full 5 6set pids 7 8for iin ( seq 16 ) 9command true& 10set -a pids$last_pid 11command false& 12set -a pids$last_pid 13end 14 15# Note fish does not (yet) report the exit status of waited-on commands. 16for pidin $pids 17wait $pid 18end 19 20for iin ( seq 16 ) 21command true& 22command false& 23end 24wait true false 25jobs 26# CHECK: jobs: There are no jobs 27 28# Ensure on-process-exit works for exited jobs. 29command false& 30set pid$last_pid 31 32# Ensure it gets reaped 33sleep .1 34 35function waiter --on-process-exit$pid 36echo exited$argv 37end 38# (Solaris' false exits with 255, not 1) 39# CHECK: exited PROCESS_EXIT {{\d+}} {{1|255}} 40 41# Regression test for #9002 42sleep 1 & 43set p1$last_pid 44 45sleep 2 & 46set p2$last_pid 47 48function p1_cb --on-process-exit$p1 49echo "P1 over" 50end 51 52function p2_cb --on-process-exit$p2 53echo "P2 over" 54end 55 56wait 57# CHECK: P1 over 58# CHECK: P2 over 59 60# Events for background jobs from event handlers (#9096) 61function __test_background_job_exit_event --on-variable trigger_var 62sleep .1& 63function callback --on-process-exit( jobs --last --pid) 64echo -n"Callback called" 65end 66end 67set trigger_var123 68sleep .5 69# CHECK: Callback called 70 71wait ( math 2 ^32 ) 72# CHECKERR: wait: '4294967296' is not a valid process ID 73wait 0 74# CHECKERR: wait: '0' is not a valid process ID 75wait ---1 76# CHECKERR: wait: Could not find child processes with the name '-1' 77wait -- -( math 2 ^31 ) 78# CHECKERR: wait: Could not find child processes with the name '-2147483648' 79 80wait 999999999 81# CHECKERR: wait: Could not find a job with process ID '999999999'