diff options
| author | Thomas Linford <tlinford@users.noreply.github.com> | 2022-05-17 20:29:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-17 20:29:06 +0200 |
| commit | e663ef2db760bdc05694b1053702bdc22c4f9d08 (patch) | |
| tree | e4d2a9cb8d01480dac92009df3601ea5127e57f7 | |
| parent | docs(changelog): paste freeze fix (diff) | |
| download | sl0ppij-e663ef2db760bdc05694b1053702bdc22c4f9d08.tar.gz sl0ppij-e663ef2db760bdc05694b1053702bdc22c4f9d08.tar.xz sl0ppij-e663ef2db760bdc05694b1053702bdc22c4f9d08.zip | |
fix: ensure pty_writer thread closes (#1422)
| -rw-r--r-- | zellij-server/src/lib.rs | 1 | ||||
| -rw-r--r-- | zellij-server/src/pty_writer.rs | 5 | ||||
| -rw-r--r-- | zellij-utils/src/errors.rs | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs index c170541f..81b66801 100644 --- a/zellij-server/src/lib.rs +++ b/zellij-server/src/lib.rs @@ -116,6 +116,7 @@ impl Drop for SessionMetaData { let _ = self.senders.send_to_pty(PtyInstruction::Exit); let _ = self.senders.send_to_screen(ScreenInstruction::Exit); let _ = self.senders.send_to_plugin(PluginInstruction::Exit); + let _ = self.senders.send_to_pty_writer(PtyWriteInstruction::Exit); let _ = self.screen_thread.take().unwrap().join(); let _ = self.pty_thread.take().unwrap().join(); let _ = self.wasm_thread.take().unwrap().join(); diff --git a/zellij-server/src/pty_writer.rs b/zellij-server/src/pty_writer.rs index 9cdcd976..760b67a1 100644 --- a/zellij-server/src/pty_writer.rs +++ b/zellij-server/src/pty_writer.rs @@ -5,12 +5,14 @@ use crate::thread_bus::Bus; #[derive(Debug, Clone)] pub(crate) enum PtyWriteInstruction { Write(Vec<u8>, i32), + Exit, } impl From<&PtyWriteInstruction> for PtyWriteContext { fn from(tty_write_instruction: &PtyWriteInstruction) -> Self { match *tty_write_instruction { PtyWriteInstruction::Write(..) => PtyWriteContext::Write, + PtyWriteInstruction::Exit => PtyWriteContext::Exit, } } } @@ -29,6 +31,9 @@ pub(crate) fn pty_writer_main(bus: Bus<PtyWriteInstruction>) { log::error!("failed to drain terminal: {}", e); }; } + PtyWriteInstruction::Exit => { + break; + } } } } diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs index ec709b21..718cb35f 100644 --- a/zellij-utils/src/errors.rs +++ b/zellij-utils/src/errors.rs @@ -343,4 +343,5 @@ pub enum ServerContext { #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] pub enum PtyWriteContext { Write, + Exit, } |
