Skip to content

Commit 5c78bc0

Browse files
committed
fix(pty): Reduce timeout overhead
Right now, we require at least two timeout lengths on a successful run. Now, we should only need the runtime plus timeout.
1 parent 11a5381 commit 5c78bc0

File tree

1 file changed

+1
-10
lines changed
  • crates/completest-pty/src

1 file changed

+1
-10
lines changed

crates/completest-pty/src/lib.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -480,16 +480,7 @@ fn comptest(
480480
// since we don't know when exactly shell is done completing the idea is to wait until
481481
// something at all is produced, then wait for some duration since the last produced chunk.
482482
rcv.recv().unwrap();
483-
loop {
484-
std::thread::sleep(timeout);
485-
let mut cnt = 0;
486-
while rcv.try_recv().is_ok() {
487-
cnt += 1;
488-
}
489-
if cnt == 0 {
490-
break;
491-
}
492-
}
483+
while rcv.recv_timeout(timeout).is_ok() {}
493484
shutdown_ref.store(true, std::sync::atomic::Ordering::SeqCst);
494485
process.exit(false).unwrap();
495486
});

0 commit comments

Comments
 (0)