Now handling CtrlC properly
This commit is contained in:
@ -16,3 +16,4 @@ unicode-segmentation = "1.6.0"
|
|||||||
which = { version = "4.4.0", features = ["regex"] }
|
which = { version = "4.4.0", features = ["regex"] }
|
||||||
regex = "1.7.1"
|
regex = "1.7.1"
|
||||||
yaml-rust = "0.4.5"
|
yaml-rust = "0.4.5"
|
||||||
|
ctrlc = "3.2.5"
|
||||||
|
|||||||
@ -30,6 +30,8 @@ pub mod shell {
|
|||||||
//used for home directory
|
//used for home directory
|
||||||
extern crate dirs;
|
extern crate dirs;
|
||||||
|
|
||||||
|
extern crate ctrlc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fn process_line(input: &str) -> String {
|
fn process_line(input: &str) -> String {
|
||||||
@ -112,7 +114,7 @@ pub mod shell {
|
|||||||
.expect("Failed to wait on child");
|
.expect("Failed to wait on child");
|
||||||
let status = output.status
|
let status = output.status
|
||||||
.code()
|
.code()
|
||||||
.expect("Could not get retcode")
|
.unwrap_or(255)
|
||||||
.to_string();
|
.to_string();
|
||||||
previous_command = None;
|
previous_command = None;
|
||||||
let format_res = format!("{}",
|
let format_res = format!("{}",
|
||||||
@ -290,6 +292,11 @@ pub mod shell {
|
|||||||
let mut current_pos: usize = 0;
|
let mut current_pos: usize = 0;
|
||||||
let mut max_pos: usize = 0;
|
let mut max_pos: usize = 0;
|
||||||
|
|
||||||
|
//Handle Ctrl+C
|
||||||
|
ctrlc::set_handler(|| {
|
||||||
|
();
|
||||||
|
}).unwrap();
|
||||||
|
|
||||||
let mut conf = match SqishConf::from_sqishrc() {
|
let mut conf = match SqishConf::from_sqishrc() {
|
||||||
Ok(c) => c,
|
Ok(c) => c,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user