mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 04:41:14 -03:00
Add fish_job_summary, called whenever a job ends, stops, or is signalled
This allows users to customise the behaviour of the shell by redefining the function. This is similar to how fish_title or fish_greeting behave, where the default implementation can be easily overridden. The function receives as arguments the job id, command line, signal name and signal description.
This commit is contained in:
committed by
Johannes Altmanninger
parent
e3c4692031
commit
324fa64114
39
tests/job_summary.expect
Normal file
39
tests/job_summary.expect
Normal file
@@ -0,0 +1,39 @@
|
||||
# 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]+: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]+: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]+:true | sleep 6:SIGKILL:Forced quit:\[0-9]+:sleep"
|
||||
send_line ""
|
||||
expect_prompt
|
||||
0
tests/job_summary.expect.err
Normal file
0
tests/job_summary.expect.err
Normal file
0
tests/job_summary.expect.out
Normal file
0
tests/job_summary.expect.out
Normal file
Reference in New Issue
Block a user