diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index db349d3..986e006 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,4 @@ mod recite; -use ctrlc; use recite::path::prefresh; use recite::Poem; use std::io::{self, Write}; @@ -28,7 +27,6 @@ fn repl(path: &Vec<&Path>, prompt: &str) { // Main shell loop loop { // Output the prompt - io::stdout().flush().unwrap(); print!("{}", prompt); io::stdout().flush().unwrap(); @@ -83,11 +81,13 @@ fn main() { let prompt = "|> "; // Handle signals - ctrlc::set_handler(move || { - print!("\n{}", prompt); - io::stdout().flush().unwrap(); - }) - .expect("dwvsh: signals: unable to set sigint handler"); + unsafe { + signal_hook::low_level::register(signal_hook::consts::SIGINT, move || { + print!("\n{}", prompt); + io::stdout().flush().unwrap(); + }) + .unwrap(); + }; // Begin evaluating commands repl(&path, prompt); |