From 15845f71c868587851e81b7a415c9f5f417f0fd4 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Fri, 20 Nov 2026 20:50:41 -0700 Subject: [PATCH] fix(gui): the dock compiles on Windows, where the agent ends when its pty drops Pty::child exists only on Unix; the child's pid is now Some on Unix and None on Windows, so the kill after the grace happens only where it can. Co-Authored-By: Claude Sonnet 5.5 --- crates/ledger-gui/src/dock.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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