diff options
author | Aram Drevekenin <aram@poor.dev> | 2021-07-05 18:51:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-05 18:51:14 +0200 |
commit | 47206866b68a00222a95b02abbfdbf0a6f38c781 (patch) | |
tree | 78f6ccb3ec214bf9e5568207f71ff52c1a0c81a8 /zellij-server/src/pty.rs | |
parent | 9c419a0a4f5a6a4184cfe9169ba8eaf3113946c1 (diff) |
fix(os): attempt to stop children with SIGTERM before SIGKILL (#601)
* fix(os): attempt to stop children with SIGTERM before SIGKILL
* style(fmt): make rustfmt happy
Diffstat (limited to 'zellij-server/src/pty.rs')
-rw-r--r-- | zellij-server/src/pty.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/zellij-server/src/pty.rs b/zellij-server/src/pty.rs index 0dba3611b..cc23e77ea 100644 --- a/zellij-server/src/pty.rs +++ b/zellij-server/src/pty.rs @@ -273,9 +273,20 @@ impl Pty { PaneId::Terminal(id) => { let child_pid = self.id_to_child_pid.remove(&id).unwrap(); let handle = self.task_handles.remove(&id).unwrap(); - self.bus.os_input.as_mut().unwrap().kill(child_pid).unwrap(); task::block_on(async { - handle.cancel().await; + self.bus.os_input.as_mut().unwrap().kill(child_pid).unwrap(); + let timeout = Duration::from_millis(100); + match async_timeout(timeout, handle.cancel()).await { + Ok(_) => {} + _ => { + self.bus + .os_input + .as_mut() + .unwrap() + .force_kill(child_pid) + .unwrap(); + } + }; }); } PaneId::Plugin(pid) => drop( |