mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-30 14:24:35 +08:00
518170b299
The default implementation will not print any output in that case, but this provides users with additional flexibility when it comes to customising the shell's behaviour.
40 lines
1.0 KiB
Plaintext
40 lines
1.0 KiB
Plaintext
# 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
|
|
expect -re "\[0-9]+:0:sleep 0.5 &:ENDED"
|
|
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
|
|
expect -re "\[0-9]+:0:sleep 10 &:SIGTERM:Polite quit request"
|
|
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
|
|
expect -re "\[0-9]+:1:true|sleep 6:SIGKILL:Forced quit:\[0-9]+:sleep"
|
|
send_line ""
|
|
expect_prompt
|