mirror of
				https://github.com/Icinga/icinga2.git
				synced 2025-11-03 21:25:56 +01:00 
			
		
		
		
	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:
		
							parent
							
								
									9f4f930559
								
							
						
					
					
						commit
						51b900b307
					
				@ -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);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user