Skip to content

Commit 4865776

Browse files
committed
Process test: wait until the detached child has left the group
`a_detached_pipe_cannot_hang_completion` started a `setsid` child and exited after a fixed 0.1 s. On a slow runner the child had not called setsid() yet, so the runner's group kill took it too, the pipe closed, and the output was not marked truncated. The shell now exits once the child has written its pid, which it does after setsid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fn7NbipAkYG7cYZxHk8xRu
1 parent 26d6b74 commit 4865776

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎native/core/tests/process_stress.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ async fn a_detached_pipe_cannot_hang_completion() {
117117
let root = tempfile::tempdir().unwrap();
118118
let result = run(
119119
ProcessSpec::shell(
120-
"setsid sh -c 'echo $$ > escaped.pid; sleep 8' & sleep .1; printf done",
120+
// Exit only once the child has left the shell's process group
121+
// (it writes its pid after setsid); a fixed pause could end the
122+
// shell first on a slow runner, and the group kill took it too.
123+
"setsid sh -c 'echo $$ > escaped.pid; sleep 8' & \
124+
while [ ! -s escaped.pid ]; do sleep .02; done; printf done",
121125
root.path().into(),
122126
Duration::from_secs(3),
123127
),

0 commit comments

Comments
 (0)