fix: ensure pty_writer thread closes (#1422)
This commit is contained in:
parent
9b184a351b
commit
e663ef2db7
3 changed files with 7 additions and 0 deletions
|
|
@ -116,6 +116,7 @@ impl Drop for SessionMetaData {
|
||||||
let _ = self.senders.send_to_pty(PtyInstruction::Exit);
|
let _ = self.senders.send_to_pty(PtyInstruction::Exit);
|
||||||
let _ = self.senders.send_to_screen(ScreenInstruction::Exit);
|
let _ = self.senders.send_to_screen(ScreenInstruction::Exit);
|
||||||
let _ = self.senders.send_to_plugin(PluginInstruction::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.screen_thread.take().unwrap().join();
|
||||||
let _ = self.pty_thread.take().unwrap().join();
|
let _ = self.pty_thread.take().unwrap().join();
|
||||||
let _ = self.wasm_thread.take().unwrap().join();
|
let _ = self.wasm_thread.take().unwrap().join();
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,14 @@ use crate::thread_bus::Bus;
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub(crate) enum PtyWriteInstruction {
|
pub(crate) enum PtyWriteInstruction {
|
||||||
Write(Vec<u8>, i32),
|
Write(Vec<u8>, i32),
|
||||||
|
Exit,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&PtyWriteInstruction> for PtyWriteContext {
|
impl From<&PtyWriteInstruction> for PtyWriteContext {
|
||||||
fn from(tty_write_instruction: &PtyWriteInstruction) -> Self {
|
fn from(tty_write_instruction: &PtyWriteInstruction) -> Self {
|
||||||
match *tty_write_instruction {
|
match *tty_write_instruction {
|
||||||
PtyWriteInstruction::Write(..) => PtyWriteContext::Write,
|
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);
|
log::error!("failed to drain terminal: {}", e);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
PtyWriteInstruction::Exit => {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -343,4 +343,5 @@ pub enum ServerContext {
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
|
||||||
pub enum PtyWriteContext {
|
pub enum PtyWriteContext {
|
||||||
Write,
|
Write,
|
||||||
|
Exit,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue