Merge pull request from Icinga/fix/erroneous-console-exit

Reset terminal on erroneous console exit
This commit is contained in:
Michael Friedrich 2018-09-13 13:34:58 +02:00 committed by GitHub
commit c8d4e785a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -532,6 +532,12 @@ void ConsoleCommand::ExecuteScriptCompletionHandler(boost::mutex& mutex, boost::
} catch (const std::exception& ex) {
Log(LogCritical, "ConsoleCommand")
<< "HTTP query failed: " << ex.what();
#ifdef HAVE_EDITLINE
/* Ensures that the terminal state is resetted */
rl_deprep_terminal();
#endif /* HAVE_EDITLINE */
Application::Exit(EXIT_FAILURE);
}
}
@ -554,6 +560,12 @@ void ConsoleCommand::AutocompleteScriptCompletionHandler(boost::mutex& mutex, bo
} catch (const std::exception& ex) {
Log(LogCritical, "ConsoleCommand")
<< "HTTP query failed: " << ex.what();
#ifdef HAVE_EDITLINE
/* Ensures that the terminal state is resetted */
rl_deprep_terminal();
#endif /* HAVE_EDITLINE */
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);