Wait for process completion in the unified exec reuse test (#57244)

Replace the fixed 200 ms sleep in
`reusing_completed_process_returns_unknown_process` with polling until
`write_stdin` reports no process ID, bounded by a 10-second timeout. This
ensures the shell has completed before asserting that reusing its process
ID returns `UnknownProcessId`.

GitOrigin-RevId: c752e9c2c0a419fa5a06ba957bee49dcaeb5d6d2
This commit is contained in:
goodman-oai
2026-10-26 20:46:21 +00:00
committed by copyberry
parent 7a9625f3ee
commit cc6baf9c32
+11 -6
View File
@@ -553,12 +553,17 @@ async fn reusing_completed_process_returns_unknown_process() -> anyhow::Result<(
.await?;
let process_id = open_shell.process_id.expect("expected process id");
write_stdin(
&session, &turn, process_id, "exit\n", /*yield_time_ms*/ 2_500,
)
.await?;
tokio::time::sleep(Duration::from_millis(200)).await;
tokio::time::timeout(Duration::from_secs(/*secs*/ 10), async {
let mut response = write_stdin(
&session, &turn, process_id, "exit\n", /*yield_time_ms*/ 2_500,
)
.await?;
while response.process_id.is_some() {
response = write_stdin(&session, &turn, process_id, "", /*yield_time_ms*/ 100).await?;
}
anyhow::Ok(())
})
.await??;
let err = write_stdin(&session, &turn, process_id, "", /*yield_time_ms*/ 100)
.await