Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove 100ms delay on first and subsequent read calls #76

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading