From 484d8c26ac2715fd522bd6ed03cf1d877901e664 Mon Sep 17 00:00:00 2001 From: Pirmin Kalberer Date: Thu, 19 Sep 2019 22:55:53 +0200 Subject: [PATCH] Save history when leaving with Ctrl-C --- src/cli.rs | 1 + src/commands/classified.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index b410fadf00..ef809ecc10 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -399,6 +399,7 @@ pub async fn cli() -> Result<(), Box> { LineResult::CtrlC => { if ctrlcbreak { + let _ = rl.save_history(&History::path()); std::process::exit(0); } else { context.with_host(|host| host.stdout("CTRL-C pressed (again to quit)")); diff --git a/src/commands/classified.rs b/src/commands/classified.rs index b042441403..eb51f9c4c6 100644 --- a/src/commands/classified.rs +++ b/src/commands/classified.rs @@ -130,7 +130,7 @@ impl InternalCommand { CommandAction::AddSpanSource(uuid, span_source) => { context.add_span_source(uuid, span_source); } - CommandAction::Exit => std::process::exit(0), + CommandAction::Exit => std::process::exit(0), // TODO: save history.txt CommandAction::EnterHelpShell(value) => { match value { Tagged { @@ -170,7 +170,7 @@ impl InternalCommand { CommandAction::LeaveShell => { context.shell_manager.remove_at_current(); if context.shell_manager.is_empty() { - std::process::exit(0); + std::process::exit(0); // TODO: save history.txt } } },