Reset terminal on erroneous console exit

This ensures that the terminal is resetted on an erroneous exit when using the Icinga 2 console.

refs #6382
This commit is contained in:
Michael Insel 2018-08-05 15:18:09 +02:00
parent 9f4f930559
commit 51b900b307
2 changed files with 10 additions and 0 deletions

View File

@ -532,6 +532,11 @@ void ConsoleCommand::ExecuteScriptCompletionHandler(boost::mutex& mutex, boost::
} catch (const std::exception& ex) {
Log(LogCritical, "ConsoleCommand")
<< "HTTP query failed: " << ex.what();
/* Ensures that the terminal state is resetted */
rl_deprep_terminal();
Application::Exit(EXIT_FAILURE);
}
}
@ -554,6 +559,10 @@ void ConsoleCommand::AutocompleteScriptCompletionHandler(boost::mutex& mutex, bo
} catch (const std::exception& ex) {
Log(LogCritical, "ConsoleCommand")
<< "HTTP query failed: " << ex.what();
/* Ensures that the terminal state is resetted */
rl_deprep_terminal();
Application::Exit(EXIT_FAILURE);
}
}

View File

@ -24,6 +24,7 @@ extern "C" {
char *readline(const char *prompt);
int add_history(const char *line);
void rl_deprep_terminal();
typedef char *ELFunction(const char *, int);