From f2a2d099bb125a4a55a398e45aa6f08adffcf233 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 23 Mar 2023 11:54:23 -0700 Subject: [PATCH] pty: unix: empty signal mask in the spawned child A user reported that ctrl-c and ctrl-\ had no effect for them in bash when spawned in a particular way on their system. It turned out that the spawning environment had blocked SIGINT, SIGHUP and SIGQUIT and that was propagated all the way down through the wezterm process to the spawned shell. Let's ensure that we clear all blocked signals prior to launching our child process. --- pty/src/unix.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pty/src/unix.rs b/pty/src/unix.rs index 53389eb85..094e07a3b 100644 --- a/pty/src/unix.rs +++ b/pty/src/unix.rs @@ -216,6 +216,9 @@ impl PtyFd { libc::signal(*signo, libc::SIG_DFL); } + let empty_set: libc::sigset_t = std::mem::zeroed(); + libc::sigprocmask(libc::SIG_SETMASK, &empty_set, std::ptr::null_mut()); + // Establish ourselves as a session leader. if libc::setsid() == -1 { return Err(io::Error::last_os_error());