Skip to content

Commit 763096c

Browse files
committed
fix: flush stderr after listening log for socket readiness visibility
When server binds socket and logs 'listening', the log may be buffered in the pipe created by tests (stderr(Stdio::piped())). Tests that poll for socket existence see the file immediately, but buffering delays visibility. Flushing ensures tests reliably observe the log.
1 parent 73423c1 commit 763096c

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit af2db7c64a1b9f92d3cd562685a2b53aac080a40
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 7c6e3862ec319c431678274acda20a3b5ea1d24b

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)