mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-01 15:14:26 +08:00
7b1321f9a1
Cancellation groups were meant to reflect the following idea: if you ran a simple block: begin cmd1 cmd2 end then under job control, cmd1 and cmd2 would get separate groups; however if either exits due to SIGINT or SIGQUIT we also want to propagate that to the outer block. So the outermost block and its interior jobs would share a cancellation group. However this is more complex than necessary; it's sufficient for the execution context to just store an int internally. This ought not to affect anything user-visible.
28 lines
650 B
Python
28 lines
650 B
Python
#!/usr/bin/env python3
|
|
from pexpect_helper import SpawnedProc
|
|
|
|
sp = SpawnedProc()
|
|
sendline, sleep, expect_prompt, expect_str = (
|
|
sp.sendline,
|
|
sp.sleep,
|
|
sp.expect_prompt,
|
|
sp.expect_str,
|
|
)
|
|
|
|
# Ensure that if child processes SIGINT, we exit our loops.
|
|
# This is an interactive test because the parser is expected to
|
|
# recover from SIGINT in interactive mode.
|
|
# Test for #7259.
|
|
|
|
expect_prompt()
|
|
sendline("while true; sh -c 'echo Here we go; sleep .25; kill -s INT $$'; end")
|
|
sleep(0.30)
|
|
expect_str("Here we go")
|
|
expect_prompt()
|
|
sendline("echo $status")
|
|
expect_str("130")
|
|
|
|
sendline("echo it worked")
|
|
expect_str("it worked")
|
|
expect_prompt()
|