aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2020-09-09 19:27:27 +0200
committerAram Drevekenin <aram@poor.dev>2020-09-09 19:27:27 +0200
commiteaaac9524fca0d03dac0879b546ad0a09feae58b (patch)
tree7499ad77fdefc7a153932cd0a8cb9e17fcb6db28 /src
parentfeat(resize): resize along grid lines vertically (diff)
downloadsl0ppij-eaaac9524fca0d03dac0879b546ad0a09feae58b.tar.gz
sl0ppij-eaaac9524fca0d03dac0879b546ad0a09feae58b.tar.xz
sl0ppij-eaaac9524fca0d03dac0879b546ad0a09feae58b.zip
fix(infra): do not block while reading from terminal, handle more than <cores> terminals
Diffstat (limited to 'src')
-rw-r--r--src/main.rs4
-rw-r--r--src/os_input_output.rs4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 1e1bb932..b40f4484 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1496,6 +1496,8 @@ impl PtyBus {
}
if !bytes_is_empty {
send_screen_instructions.send(ScreenInstruction::Render).unwrap();
+ } else {
+ task::sleep(::std::time::Duration::from_millis(10)).await;
}
}
}
@@ -1518,6 +1520,8 @@ impl PtyBus {
}
if !bytes_is_empty {
send_screen_instructions.send(ScreenInstruction::Render).unwrap();
+ } else {
+ task::sleep(::std::time::Duration::from_millis(10)).await;
}
}
}
diff --git a/src/os_input_output.rs b/src/os_input_output.rs
index a6e2159f..75c131c7 100644
--- a/src/os_input_output.rs
+++ b/src/os_input_output.rs
@@ -62,8 +62,8 @@ fn spawn_terminal () -> (RawFd, RawFd) {
let pid_primary = fork_pty_res.master;
let pid_secondary = match fork_pty_res.fork_result {
ForkResult::Parent { child } => {
- fcntl(pid_primary, FcntlArg::F_SETFL(OFlag::empty())).expect("could not fcntl");
- // fcntl(pid_primary, FcntlArg::F_SETFL(OFlag::O_NONBLOCK)).expect("could not fcntl");
+ // fcntl(pid_primary, FcntlArg::F_SETFL(OFlag::empty())).expect("could not fcntl");
+ fcntl(pid_primary, FcntlArg::F_SETFL(OFlag::O_NONBLOCK)).expect("could not fcntl");
child
},
ForkResult::Child => {