mirror of
https://github.com/openai/codex.git
synced 2026-11-16 22:00:36 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user