dont spin at max speed when waiting for foreground process

Signed-off-by: Ava Hahn <ava@sunnypup.io>
This commit is contained in:
Ava Apples Affine 2023-10-18 14:29:53 -07:00
parent e042cd1152
commit 5dcf601384
2 changed files with 7 additions and 5 deletions

View file

@ -1,4 +1,3 @@
#+Title: Relish: Rusty Expressive LIsp SHell
#+Author: Ava Hahn
@ -155,9 +154,8 @@ Note: this section only tracks the state of incomplete TODO items. Having everyt
** DONE Beta tasks
(See tag: v0.3.0)
** TODO v1.0 tasks
- set library
- Can pass args to relish scripts (via interpreter)
- Can pass args to relish scripts (via command line)
- Can pass args to relish scripts (via interpreter)
- finish basic goals in the [[file:snippets/interactive-devel.rls][interactive development library]]
- Release CI
- Rename to Flesh
@ -167,7 +165,6 @@ Note: this section only tracks the state of incomplete TODO items. Having everyt
- finish stretch goals in the [[file:snippets/interactive-devel.rls][interactive development library]]
- History length configurable (env var?)
- Lex function
- Read function (Input + Lex)
- execute configurable function on cd
- Post to relevant channels
- Implement Compose for lambdas

View file

@ -50,6 +50,8 @@ use {
env::set_current_dir,
os::unix::process::CommandExt,
mem,
thread,
time::Duration,
},
nix::{
unistd, unistd::Pid,
@ -216,7 +218,7 @@ fn launch_command(
}
// the analogous make_background happens in the app when the user sends it the corresponding signal
fn make_foreground(pid: u32, state: &mut ShellState) -> Result<(), String>{
fn make_foreground(pid: u32, state: &mut ShellState) -> Result<(), String> {
for i in &mut state.children {
if i.id() == pid {
let pid_fancy = Pid::from_raw(pid as i32);
@ -253,6 +255,9 @@ fn make_foreground(pid: u32, state: &mut ShellState) -> Result<(), String>{
.unwrap_or(-1);
break;
} else {
// sleep 1 sec
thread::sleep(Duration::from_millis(1000));
}
},
Err(e) => {