2020-04-30 04:14:12 +00:00
|
|
|
# vim: set filetype=expect:
|
|
|
|
#
|
|
|
|
# Test job summary for interactive shells.
|
|
|
|
|
|
|
|
set pid [spawn $fish]
|
|
|
|
expect_prompt
|
|
|
|
|
|
|
|
send_line "function fish_job_summary; string join ':' \$argv; end"
|
|
|
|
expect_prompt
|
|
|
|
|
|
|
|
# fish_job_summary is called when background job ends.
|
|
|
|
send_line "sleep 0.5 &"
|
|
|
|
sleep 0.050
|
|
|
|
expect_prompt
|
|
|
|
sleep 0.550
|
2020-04-30 19:15:29 +00:00
|
|
|
expect -re "\[0-9]+:0:sleep 0.5 &:ENDED"
|
2020-04-30 04:14:12 +00:00
|
|
|
send_line ""
|
|
|
|
expect_prompt
|
|
|
|
|
|
|
|
# fish_job_summary is called when background job is signalled.
|
|
|
|
# cmd_line correctly prints only the actually backgrounded job.
|
|
|
|
send_line "false; sleep 10 &; true"
|
|
|
|
sleep 0.100
|
|
|
|
expect_prompt
|
|
|
|
exec -- pkill -TERM sleep -P $pid
|
|
|
|
sleep 0.100
|
2020-04-30 19:15:29 +00:00
|
|
|
expect -re "\[0-9]+:0:sleep 10 &:SIGTERM:Polite quit request"
|
2020-04-30 04:14:12 +00:00
|
|
|
send_line ""
|
|
|
|
expect_prompt
|
|
|
|
|
|
|
|
# fish_job_summary is called when foreground job is signalled.
|
|
|
|
# cmd_line contains the entire pipeline. proc_id and proc_name are set in a pipeline.
|
|
|
|
send_line "true | sleep 6"
|
|
|
|
sleep 0.100
|
|
|
|
exec -- pkill -KILL sleep -P $pid
|
|
|
|
sleep 0.100
|
2020-04-30 19:15:29 +00:00
|
|
|
expect -re "\[0-9]+:1:true|sleep 6:SIGKILL:Forced quit:\[0-9]+:sleep"
|
2020-04-30 04:14:12 +00:00
|
|
|
send_line ""
|
|
|
|
expect_prompt
|