H1: child processes die with Lutra (crates/proc)
New layer-0 crate lutra-proc: spawn(Command) puts the child into a kill-on-close group. Windows: one job object per child with JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE (windows-sys), nested jobs work. Unix: a new process group plus a /bin/sh watchdog that kills the group when Lutra's pipe closes (drop, kill, quit or SIGKILL of Lutra). Child::kill and Drop take the whole group. Phpactor (supervision spawn) and the php -v probe in lutra-lsp start through it. Tests kill a parent hard and check that its child is gone (with and without the parent in a group), plus kill and drop of a tree. Docs: architecture "Child processes", G6 note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e5891ddeb4
commit
90d03284f2
13 changed files with 555 additions and 14 deletions
29
crates/proc/Cargo.toml
Normal file
29
crates/proc/Cargo.toml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
[package]
|
||||
name = "lutra-proc"
|
||||
description = "Child processes that die with Lutra: job objects on Windows, process groups on Unix"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[package.metadata.lutra]
|
||||
layer = 0
|
||||
|
||||
[[bin]]
|
||||
name = "lutra-proc-helper"
|
||||
path = "src/bin/lutra-proc-helper.rs"
|
||||
test = false
|
||||
doc = false
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
windows-sys = { version = "0.61.2", features = [
|
||||
"Win32_Foundation",
|
||||
"Win32_Security",
|
||||
"Win32_System_JobObjects",
|
||||
"Win32_System_Threading",
|
||||
] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
Loading…
Add table
Add a link
Reference in a new issue