Skip to content

Commit 3596e0d

Browse files
committed
mac test
1 parent 4202dc1 commit 3596e0d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/lib.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ pub async fn run_command_with_timeout(
513513

514514
// Main execution loop
515515
run_command_loop(&mut state, &timeout_config).await?;
516+
let end_time = Instant::now();
516517

517518
// Drain remaining output after loop exit (natural exit or timeout break)
518519
debug!("Command loop finished. Draining remaining output streams.");
@@ -530,6 +531,7 @@ pub async fn run_command_with_timeout(
530531
"stderr",
531532
)
532533
.await?;
534+
let duration = end_time.duration_since(start_time);
533535

534536
// Post-loop processing: Final wait if killed and status not yet obtained
535537
let final_exit_status = finalize_exit_status(
@@ -539,8 +541,6 @@ pub async fn run_command_with_timeout(
539541
)
540542
.await?;
541543

542-
let end_time = Instant::now();
543-
let duration = end_time.duration_since(start_time);
544544

545545
debug!(
546546
duration = ?duration,
@@ -924,11 +924,8 @@ mod tests {
924924
run_async_test(|| async {
925925
let mut cmd = StdCommand::new("sh");
926926
// Continuously output numbers for ~2 seconds, sleeping shortly
927-
// cmd.arg("-c")
928-
// .arg("i=0; while [ $i -lt 20 ]; do echo $i; i=$((i+1)); sleep 0.1; done");
929-
let mut cmd = StdCommand::new("bash");
930-
cmd.arg("-c")
931-
.arg("for ((i=0; i<20; i++)); do echo $i; sleep 0.1; done");
927+
cmd.arg("-c")
928+
.arg("i=0; while [ $i -lt 20 ]; do echo $i; i=$((i+1)); sleep 0.1; done");
932929
let min_timeout = Duration::from_millis(50);
933930
let max_timeout = Duration::from_secs(10);
934931
let activity_timeout = Duration::from_millis(500); // activity > sleep

0 commit comments

Comments
 (0)