diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 986e006..44f2726 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ mod recite; +use libc::{waitpid, WNOHANG}; use recite::path::prefresh; use recite::Poem; use std::io::{self, Write}; @@ -53,11 +54,12 @@ fn repl(path: &Vec<&Path>, prompt: &str) { // Parse a poem let poem = Poem::read(poetry); match poem { - Some(poem) => { - poem.recite(path, &mut bins); - } + Some(poem) => match poem.recite(path, &mut bins) { + Ok(_) => {} + Err(e) => eprintln!("dwvsh: {}", e), + }, None => {} - } + }; } } @@ -87,6 +89,16 @@ fn main() { io::stdout().flush().unwrap(); }) .unwrap(); + + signal_hook::low_level::register(signal_hook::consts::SIGCHLD, move || { + let mut status: i32 = -1; + let pid: i32 = waitpid(-1, &mut status, WNOHANG); + if pid != -1 { + print!("[&] + done {}", pid); + io::stdout().flush().unwrap(); + } + }) + .unwrap(); }; // Begin evaluating commands |