mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 06:02:44 +00:00 
			
		
		
		
	Shell: Treat ^D as builtin_exit when not in a continuation
This commit is contained in:
		
							parent
							
								
									f3b09ddd8e
								
							
						
					
					
						commit
						8c05e78b6c
					
				
					 1 changed files with 18 additions and 5 deletions
				
			
		|  | @ -1719,11 +1719,24 @@ bool Shell::read_single_line() | |||
|     auto line_result = editor->get_line(prompt()); | ||||
| 
 | ||||
|     if (line_result.is_error()) { | ||||
|         m_complete_line_builder.clear(); | ||||
|         m_should_continue = ContinuationRequest::Nothing; | ||||
|         m_should_break_current_command = false; | ||||
|         Core::EventLoop::current().quit(line_result.error() == Line::Editor::Error::Eof ? 0 : 1); | ||||
|         return false; | ||||
|         if (line_result.error() == Line::Editor::Error::Eof || line_result.error() == Line::Editor::Error::Empty) { | ||||
|             // Pretend the user tried to execute builtin_exit()
 | ||||
|             // but only if there's no continuation.
 | ||||
|             if (m_should_continue == ContinuationRequest::Nothing) { | ||||
|                 m_complete_line_builder.clear(); | ||||
|                 run_command("exit"); | ||||
|                 return read_single_line(); | ||||
|             } else { | ||||
|                 // Ignore the Eof.
 | ||||
|                 return true; | ||||
|             } | ||||
|         } else { | ||||
|             m_complete_line_builder.clear(); | ||||
|             m_should_continue = ContinuationRequest::Nothing; | ||||
|             m_should_break_current_command = false; | ||||
|             Core::EventLoop::current().quit(1); | ||||
|             return false; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     auto& line = line_result.value(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AnotherTest
						AnotherTest