From 5b843bd08ba1591a1249af5be5743834109ff17d Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sat, 17 Sep 2016 21:28:22 +0200 Subject: [PATCH] Remove entry from history if fails to execute. Issue: #466 --- source/dialogs/run.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/dialogs/run.c b/source/dialogs/run.c index 8768a5a1..50f38e50 100644 --- a/source/dialogs/run.c +++ b/source/dialogs/run.c @@ -121,17 +121,19 @@ static void exec_cmd ( const char *cmd, int run_in_term ) return; } + char *path = g_build_filename ( cache_dir, RUN_CACHE_FILE, NULL ); if ( execsh ( lf_cmd, run_in_term ) ) { /** * This happens in non-critical time (After launching app) * It is allowed to be a bit slower. */ - char *path = g_build_filename ( cache_dir, RUN_CACHE_FILE, NULL ); history_set ( path, cmd ); - - g_free ( path ); } + else { + history_remove ( path, cmd ); + } + g_free ( path ); g_free ( lf_cmd ); }