mirror of
https://github.com/nushell/nushell
synced 2024-11-10 15:14:14 +00:00
More gracefully handle reedline errors
This commit is contained in:
parent
bf19918e3c
commit
1ba80224ad
1 changed files with 8 additions and 5 deletions
13
src/main.rs
13
src/main.rs
|
@ -172,9 +172,9 @@ fn main() -> std::io::Result<()> {
|
|||
let stack = Stack::new();
|
||||
|
||||
loop {
|
||||
let input = line_editor.read_line(&prompt)?;
|
||||
let input = line_editor.read_line(&prompt);
|
||||
match input {
|
||||
Signal::Success(s) => {
|
||||
Ok(Signal::Success(s)) => {
|
||||
if s.trim() == "exit" {
|
||||
break;
|
||||
}
|
||||
|
@ -210,15 +210,18 @@ fn main() -> std::io::Result<()> {
|
|||
}
|
||||
}
|
||||
}
|
||||
Signal::CtrlC => {
|
||||
Ok(Signal::CtrlC) => {
|
||||
println!("Ctrl-c");
|
||||
}
|
||||
Signal::CtrlD => {
|
||||
Ok(Signal::CtrlD) => {
|
||||
break;
|
||||
}
|
||||
Signal::CtrlL => {
|
||||
Ok(Signal::CtrlL) => {
|
||||
line_editor.clear_screen()?;
|
||||
}
|
||||
Err(err) => {
|
||||
println!("Error: {:?}", err);
|
||||
}
|
||||
}
|
||||
current_line += 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue