From 91093f2ab256a7d149098803b0c311b30ce18f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20N=2E=20Robalino?= Date: Mon, 26 Aug 2019 17:16:39 -0500 Subject: [PATCH 1/2] Avoid panicking if history can't be saved. --- src/cli.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.rs b/src/cli.rs index 945e607547..fa3a275c27 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -297,7 +297,7 @@ pub async fn cli() -> Result<(), Box> { } ctrlcbreak = false; } - rl.save_history("history.txt")?; + let _ = rl.save_history("history.txt"); Ok(()) } From 3e699db57c58ce722fd20ca3fc8492a5de6723f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20N=2E=20Robalino?= Date: Mon, 26 Aug 2019 17:41:57 -0500 Subject: [PATCH 2/2] Aviso. --- src/cli.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cli.rs b/src/cli.rs index fa3a275c27..614ad28f96 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -217,6 +217,7 @@ pub async fn cli() -> Result<(), Box> { let _ = ansi_term::enable_ansi_support(); } + // we are ok if history does not exist let _ = rl.load_history("history.txt"); let ctrl_c = Arc::new(AtomicBool::new(false)); @@ -297,6 +298,8 @@ pub async fn cli() -> Result<(), Box> { } ctrlcbreak = false; } + + // we are ok if we can not save history let _ = rl.save_history("history.txt"); Ok(())