Skip to content

Commit f81bbcc

Browse files
committed
fix: flush stderr after listening log and don't kill child on disconnect
Two fixes for jumpstarter-exec test failures: 1. Flush stderr after logging 'listening' so tests that poll for socket creation see the buffered log output. 2. Don't send SIGTERM to child process on client disconnect. Let child finish naturally so output forwarding threads can read any remaining stdout/stderr. Main thread reaps with wait(). Fixes test e2e_debug_json_logs_commands_and_io and related E2E tests.
1 parent 73423c1 commit f81bbcc

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

rust/jumpstarter-exec/src/server.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ pub fn serve_with(socket_path: &str, opts: ServeOptions) -> std::io::Result<()>
137137
"listening",
138138
&[("socket", json!(socket_path)), ("debug", json!(opts.debug))],
139139
);
140+
// Ensure listening log is flushed so tests that poll the socket get
141+
// visible evidence that the server is ready.
142+
let _ = std::io::stderr().flush();
140143

141144
while !state.is_shutdown() {
142145
match listener.accept() {
@@ -366,9 +369,8 @@ fn handle_exec(
366369
_ => {}
367370
}
368371
}
369-
if !reaped_ref.load(Ordering::Acquire) {
370-
unsafe { kill(pid as i32, 15) }; // SIGTERM on client disconnect
371-
}
372+
// Don't kill child on client disconnect; let it finish naturally.
373+
// The main thread will reap it with wait() after forwarding threads exit.
372374
});
373375

374376
let status = child.wait()?;

0 commit comments

Comments
 (0)