Correctly cancel on receipt of SIGHUP

When we receive SIGHUP, stop executing normal fish script (but allow
exit handlers to run).
This commit is contained in:
ridiculousfish 2020-08-29 15:43:43 -07:00
parent 0b075fce88
commit 0379f21870
2 changed files with 4 additions and 3 deletions

View File

@ -806,8 +806,8 @@ static void term_steal() {
bool check_cancel_from_fish_signal() {
switch (s_exit_state) {
case exit_state_t::none:
// No reason to exit now.
return false;
// Cancel if we got SIGHUP.
return s_sighup_received;
case exit_state_t::running_handlers:
// We intend to exit but we want to allow these handlers to run.
return false;

View File

@ -62,7 +62,8 @@ send("sleep 130 &\r")
expect_prompt()
send("sleep 131 &\r")
expect_prompt()
send("sleep 132\r")
send("sleep 9999999\r")
sleep(0.100) # ensure fish kicks off the above sleep before it gets HUP - see #7288
os.kill(sp.spawn.pid, signal.SIGHUP)
# Verify the spawned fish shell has exited.