Skip to content

Commit

Permalink
Merge pull request #76 from SilverMira/SilverMira-fix-100ms-delay
Browse files Browse the repository at this point in the history
fix: remove 100ms delay on first and subsequent read calls
  • Loading branch information
andfoy authored Jun 28, 2024
2 parents dbbefcd + 5a8aab1 commit 1ecee27
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pty/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ impl PTYProcess {
// let mut alive = reader_alive_rx.recv_timeout(Duration::from_millis(300)).unwrap_or(true);
// alive = alive && !is_eof(process, conout).unwrap();

while reader_alive_rx.recv_timeout(Duration::from_millis(100)).unwrap_or(true) {
while reader_alive_rx.try_recv().unwrap_or(true) {
if !is_eof(process, conout).unwrap() {
let result = read(4096, true, conout, using_pipes);
reader_out_tx.send(Some(result)).unwrap();
Expand All @@ -378,7 +378,7 @@ impl PTYProcess {

let cache_thread = thread::spawn(move || {
let mut read_buf = OsString::new();
while cache_alive_rx.recv_timeout(Duration::from_millis(100)).unwrap_or(true) {
while cache_alive_rx.try_recv().unwrap_or(true) {
if let Ok(Some((length, blocking))) = cache_req_rx.recv() {
let mut pending_read: Option<OsString> = None;

Expand Down

0 comments on commit 1ecee27

Please sign in to comment.