From 098be0747d150dec8207502ec4bfebf38ce805bc Mon Sep 17 00:00:00 2001 From: indev Date: Fri, 15 Jan 2021 02:00:11 +0700 Subject: [PATCH] fix: remove lock file on interruption of 'task edit' (#2292) --- src/commands/CmdEdit.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/commands/CmdEdit.cpp b/src/commands/CmdEdit.cpp index 32bd0dfce..9cad69b69 100644 --- a/src/commands/CmdEdit.cpp +++ b/src/commands/CmdEdit.cpp @@ -826,12 +826,16 @@ ARE_THESE_REALLY_HARMFUL: { std::cerr << "Error: " << problem << '\n'; - // Preserve the edits. - before = after; - File::write (file.str (), before); + File::remove (file.str()); if (confirm ("Taskwarrior couldn't handle your edits. Would you like to try again?")) + { + // Preserve the edits. + before = after; + File::write (file.str (), before); + goto ARE_THESE_REALLY_HARMFUL; + } } else changes = true;