]> granicus.if.org Git - icinga2/commitdiff
Don't add empty lines to libedit's history
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 8 Aug 2016 06:01:52 +0000 (08:01 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 8 Aug 2016 06:01:52 +0000 (08:01 +0200)
refs #12234

lib/cli/consolecommand.cpp

index 5da45da65b7be6f90fff1c71cc5df305e6da6d08..005ea9e19e5a269224795acc370985bc5de31ca9 100644 (file)
@@ -268,14 +268,12 @@ incomplete:
                        if (!cline)
                                break;
 
-                       if (commandOnce.IsEmpty()) {
+                       if (commandOnce.IsEmpty() && cline[0] != '\0') {
                                add_history(cline);
 
-                               if (cline[0] != '\0') {
-                                       historyfp.open(historyPath.CStr(), std::fstream::out | std::fstream::app);
-                                       historyfp << cline << "\n";
-                                       historyfp.close();
-                               }
+                               historyfp.open(historyPath.CStr(), std::fstream::out | std::fstream::app);
+                               historyfp << cline << "\n";
+                               historyfp.close();
                        }
 
                        line = cline;