diff --git a/crates/ledger-gui/src/dock.rs b/crates/ledger-gui/src/dock.rs index 1fa7600b..b31c506a 100644 --- a/crates/ledger-gui/src/dock.rs +++ b/crates/ledger-gui/src/dock.rs @@ -39,6 +39,8 @@ //! down, its child hung up on (SIGHUP) and reaped, its terminal //! closed; one that has not gone [`AGENT_GRACE`] later is killed //! (SIGKILL, that pid alone, which this dock started) and reaped. +//! On Windows the agent ends when its pty is dropped; no kill after +//! a grace (its pty type has no child handle). //! The reaping is a thread of the tab's, so the tab can say when //! nothing of its agent is left (`CompanyView::jobs_watch`). //! 9. The panel's height, and whether the dock is open by default, are @@ -151,7 +153,8 @@ pub struct Session { exited: Arc, title: Arc>, /// The child's process id (this session started it). - pid: u32, + /// The child's pid, where it is known (Unix); Windows has none. + pid: Option, /// Waits for the event loop's thread to end and drops what it returns, /// the PTY with it (which hangs up on the child and reaps it). end: Option>, @@ -165,7 +168,7 @@ pub const AGENT_GRACE: std::time::Duration = std::time::Duration::from_secs(2); /// End a dropped session's child: wait for its hang-up to be answered, /// kill it if it is not within [`AGENT_GRACE`], and reap it (INVARIANT 8). -fn reap(end: Box, pid: u32, ticket: Option) { +fn reap(end: Box, pid: Option, ticket: Option) { let work = move || { let _ticket = ticket; let (done_tx, done_rx) = std::sync::mpsc::channel::<()>(); @@ -180,7 +183,9 @@ fn reap(end: Box, pid: u32, ticket: Option