← Commit history

v0.11.2: serve daemonizes with setsid — the spawned server previously stayed in the launching shell's process group, so the dock reaped it the moment await:url was satisfied (ConfRoomROG cold-verify #2)

John Lauer ·8711f6cf0c ·1mo ago ·parent 8d6bbaf
5 files changed +17−3
Cargo.lock+1−1
@@ -4,7 +4,7 @@ version = 4  [[package]] name = "adom-project-manager"-version = "0.11.1"+version = "0.11.2" dependencies = [  "altium-codec",  "anyhow",
Cargo.toml+1−1
@@ -1,6 +1,6 @@ [package] name = "adom-project-manager"-version = "0.11.1"+version = "0.11.2" edition = "2021" description = "Adom Project Manager — the central hub for navigating wiki boards, molecules, and libraries into Hydrogen: browse your wiki boards/projects, view symbol + footprint + 3D and the footprint layer stackup, add components to your KiCad/Altium libraries, and deliver self-contained KiCad projects. Built on adom-lbr." 
bin/adom-project-manager
⋯ 1 unchanged line ⋯
package.json+1−1
@@ -1,6 +1,6 @@ {   "slug": "adom-project-manager",-  "version": "0.11.1",+  "version": "0.11.2",   "type": "app",   "description": "Adom Project Manager — the central hub for navigating wiki boards, molecules and libraries into Hydrogen: browse your wiki boards/projects (Personal / Organization / Public), view symbol + footprint + 3D and the per-EDA footprint layer stackup, explore the board and schematic in INTERACTIVE cross-probing viewers (click a net, hover a part for stock and price), add components to your KiCad/Altium libraries, and deliver self-contained KiCad projects. Built on adom-lbr. (Formerly Adom Project Manager / adom-project-manager.)",   "dependencies": {
src/main.rs+14
@@ -215,6 +215,18 @@ fn serve_cmd(port_flag: Option<u16>) -> i32 {     let exe = std::env::current_exe().unwrap_or_else(|_| "adom-project-manager".into());     let mut cmd = Command::new(exe);     cmd.args(["--port", &port.to_string()]).stdin(std::process::Stdio::null());+    // Detach into a NEW SESSION. Without this the server stays in the launching+    // shell's process group, and the dock reaps that group the moment `await: url`+    // is satisfied — measured on ConfRoomROG: serve printed its URL, the step+    // ended, and the server was dead before the first readiness poll.+    #[cfg(unix)]+    unsafe {+        use std::os::unix::process::CommandExt;+        cmd.pre_exec(|| {+            libc_setsid();+            Ok(())+        });+    }     match log {         Some(f) => {             let f2 = f.try_clone().ok();@@ -253,6 +265,8 @@ fn serve_cmd(port_flag: Option<u16>) -> i32 { extern "C" {     #[link_name = "kill"]     fn libc_kill(pid: i32, sig: i32) -> i32;+    #[link_name = "setsid"]+    fn libc_setsid() -> i32; }  /// Print the readiness URL (the dock's `await: url` gate) and claim the dock