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, 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) { 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, }