From 1ba80224ad98c1748d332dc6a769564dfb94c7d4 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Mon, 9 Aug 2021 17:29:25 +1200 Subject: [PATCH 1/2] More gracefully handle reedline errors --- src/main.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 90bce1d1a8..9dddd00716 100644 --- a/src/main.rs +++ b/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; } From 8a2bba4efb5810fae927ccbdb9bf39eb1b7ad334 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Mon, 9 Aug 2021 18:02:51 +1200 Subject: [PATCH 2/2] use storm's fix --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 88c3a832a7..b661d778bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,11 +6,11 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -reedline = {git = "https://github.com/jntrnr/reedline"} +reedline = { git = "https://github.com/jntrnr/reedline", branch = "main" } nu-ansi-term = "0.32.0" # mimalloc = { version = "*", default-features = false } [dev-dependencies] tempfile = "3.2.0" assert_cmd = "1.0.7" -pretty_assertions = "0.7.2" \ No newline at end of file +pretty_assertions = "0.7.2"