aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Linford <tlinford@users.noreply.github.com>2022-05-17 20:29:06 +0200
committerGitHub <noreply@github.com>2022-05-17 20:29:06 +0200
commite663ef2db760bdc05694b1053702bdc22c4f9d08 (patch)
treee4d2a9cb8d01480dac92009df3601ea5127e57f7
parentdocs(changelog): paste freeze fix (diff)
downloadsl0ppij-e663ef2db760bdc05694b1053702bdc22c4f9d08.tar.gz
sl0ppij-e663ef2db760bdc05694b1053702bdc22c4f9d08.tar.xz
sl0ppij-e663ef2db760bdc05694b1053702bdc22c4f9d08.zip
fix: ensure pty_writer thread closes (#1422)
-rw-r--r--zellij-server/src/lib.rs1
-rw-r--r--zellij-server/src/pty_writer.rs5
-rw-r--r--zellij-utils/src/errors.rs1
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,
}