mirror of
https://github.com/wez/wezterm.git
synced 2024-11-24 07:46:59 +03:00
fixup process termination detection on windows
This commit is contained in:
parent
ad41cecd6e
commit
400a85befc
@ -246,6 +246,8 @@ impl GuiEventLoop {
|
|||||||
loop {
|
loop {
|
||||||
match self.tick_rx.try_recv() {
|
match self.tick_rx.try_recv() {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
|
#[cfg(not(unix))]
|
||||||
|
self.test_for_child_exit();
|
||||||
self.do_paint();
|
self.do_paint();
|
||||||
}
|
}
|
||||||
Err(TryRecvError::Empty) => return Ok(()),
|
Err(TryRecvError::Empty) => return Ok(()),
|
||||||
@ -261,6 +263,15 @@ impl GuiEventLoop {
|
|||||||
loop {
|
loop {
|
||||||
match self.sigchld_rx.try_recv() {
|
match self.sigchld_rx.try_recv() {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
|
self.test_for_child_exit();
|
||||||
|
}
|
||||||
|
Err(TryRecvError::Empty) => return Ok(()),
|
||||||
|
Err(err) => bail!("paster_rx disconnected {:?}", err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_for_child_exit(&self) {
|
||||||
let window_ids: Vec<WindowId> = self
|
let window_ids: Vec<WindowId> = self
|
||||||
.windows
|
.windows
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
@ -273,12 +284,7 @@ impl GuiEventLoop {
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
for window_id in window_ids {
|
for window_id in window_ids {
|
||||||
self.schedule_window_close(window_id)?;
|
self.schedule_window_close(window_id).ok();
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(TryRecvError::Empty) => return Ok(()),
|
|
||||||
Err(err) => bail!("paster_rx disconnected {:?}", err),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ use winpty::winapi::shared::minwindef::DWORD;
|
|||||||
use winpty::winapi::shared::winerror::{HRESULT, S_OK};
|
use winpty::winapi::shared::winerror::{HRESULT, S_OK};
|
||||||
use winpty::winapi::um::fileapi::{ReadFile, WriteFile};
|
use winpty::winapi::um::fileapi::{ReadFile, WriteFile};
|
||||||
use winpty::winapi::um::handleapi::*;
|
use winpty::winapi::um::handleapi::*;
|
||||||
|
use winpty::winapi::um::minwinbase::STILL_ACTIVE;
|
||||||
use winpty::winapi::um::namedpipeapi::CreatePipe;
|
use winpty::winapi::um::namedpipeapi::CreatePipe;
|
||||||
use winpty::winapi::um::processthreadsapi::*;
|
use winpty::winapi::um::processthreadsapi::*;
|
||||||
use winpty::winapi::um::winbase::EXTENDED_STARTUPINFO_PRESENT;
|
use winpty::winapi::um::winbase::EXTENDED_STARTUPINFO_PRESENT;
|
||||||
@ -291,7 +292,11 @@ impl Child {
|
|||||||
let mut status: DWORD = 0;
|
let mut status: DWORD = 0;
|
||||||
let res = unsafe { GetExitCodeProcess(self.proc.handle, &mut status) };
|
let res = unsafe { GetExitCodeProcess(self.proc.handle, &mut status) };
|
||||||
if res != 0 {
|
if res != 0 {
|
||||||
|
if status == STILL_ACTIVE {
|
||||||
|
Ok(None)
|
||||||
|
} else {
|
||||||
Ok(Some(ExitStatus { status }))
|
Ok(Some(ExitStatus { status }))
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user