From a87b742ff4ce262c07b7830a25c73c1442dab41b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Hou=C5=A1ka?= Date: Wed, 28 Oct 2026 21:03:07 +0100 Subject: [PATCH] docs(env): Windows commands' descendants survive a terminated daemon The job object uses silent breakaway, as libuv does, so it only kills each command's own process. --- packages/env/daemon/src/sys/windows.rs | 3 ++- packages/env/docs/protocol.md | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/env/daemon/src/sys/windows.rs b/packages/env/daemon/src/sys/windows.rs index de39fd4c3..401719369 100644 --- a/packages/env/daemon/src/sys/windows.rs +++ b/packages/env/daemon/src/sys/windows.rs @@ -550,7 +550,8 @@ pub fn after_spawn(child: &Child) { } } -/// Nothing to do: the daemon cannot catch `TerminateProcess`, and the job object kills its commands with it. +/// Nothing to do: the daemon cannot catch `TerminateProcess`. When it ends, the job object kills each command's own +/// process; processes those start leave the job (silent breakaway, as in libuv) and keep running. pub fn on_exit_signal(_on_signal: impl FnOnce(i32) + Send + 'static) {} /// Node's `killProcessTree` on Windows: `taskkill /F /T`, not waited for. diff --git a/packages/env/docs/protocol.md b/packages/env/docs/protocol.md index f8ca5b4e1..c5e482856 100644 --- a/packages/env/docs/protocol.md +++ b/packages/env/docs/protocol.md @@ -62,10 +62,11 @@ command as a full pipe would. ## Liveness Each side sends `ping` every 5 seconds. The daemon kills every process group it started and exits after 30 seconds -without receiving any bytes, when stdin ends, or on `SIGTERM`, `SIGINT` or `SIGHUP` (on Windows, a job object kills -its commands with it). A dropped connection or a stopped daemon therefore stops remote commands. The client -fails requests of a lost connection with `{ code: "unknown", lost: true }` and starts a new daemon on the next request; -handles belong to the daemon that opened them, so requests on them fail instead of reaching the new one. +without receiving any bytes, when stdin ends, or on `SIGTERM`, `SIGINT` or `SIGHUP`. A dropped connection or a +stopped daemon therefore stops remote commands. On Windows, a terminated daemon cannot clean up: a job object kills +each command's own process, but not processes that one started. The client fails requests of a lost connection with +`{ code: "unknown", lost: true }` and starts a new daemon on the next request; handles belong to the daemon that opened +them, so requests on them fail instead of reaching the new one. ## Operations