From 6c944debecf0cb1dba610f1e6d74b2451283921c Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Thu, 30 May 2024 18:26:13 -0500 Subject: [PATCH] Send signals in the correct order in hup_jobs() If the backgrounded/stopped job was using the tty, sending it SIGCONT first might cause it to immediately wake and try to use the tty (which fish still has control over), causing it to immediately stop again after receiving a SIGTTOU. We are supposed to send SIGHUP first so that when the process resumes it sees the queued SIGHUP and executes its registered handler! --- src/proc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/proc.rs b/src/proc.rs index 66a7d97ea..c9cf830cf 100644 --- a/src/proc.rs +++ b/src/proc.rs @@ -1299,10 +1299,10 @@ pub fn hup_jobs(jobs: &JobList) { for j in jobs { let Some(pgid) = j.get_pgid() else { continue }; if pgid != fish_pgrp && !j.is_completed() { + j.signal(SIGHUP); if j.is_stopped() { j.signal(SIGCONT); } - j.signal(SIGHUP); } } }