forked from Bananymous/banan-os
				
			Shell: Don't get stuck on broken state when failing to build command
This commit is contained in:
		
							parent
							
								
									30d5d85d1d
								
							
						
					
					
						commit
						ac22e006a4
					
				|  | @ -4,6 +4,7 @@ | ||||||
| #include "TokenParser.h" | #include "TokenParser.h" | ||||||
| 
 | 
 | ||||||
| #include <BAN/HashSet.h> | #include <BAN/HashSet.h> | ||||||
|  | #include <BAN/ScopeGuard.h> | ||||||
| 
 | 
 | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| 
 | 
 | ||||||
|  | @ -659,12 +660,13 @@ BAN::ErrorOr<void> TokenParser::run(BAN::Vector<Token>&& tokens) | ||||||
| { | { | ||||||
| 	TRY(feed_tokens(BAN::move(tokens))); | 	TRY(feed_tokens(BAN::move(tokens))); | ||||||
| 
 | 
 | ||||||
|  | 	BAN::ScopeGuard _([this] { | ||||||
|  | 		m_token_stream.clear(); | ||||||
|  | 	}); | ||||||
|  | 
 | ||||||
| 	auto command_tree = TRY(parse_command_tree()); | 	auto command_tree = TRY(parse_command_tree()); | ||||||
| 
 | 
 | ||||||
| 	const auto token_type = peek_token().type(); | 	const auto token_type = peek_token().type(); | ||||||
| 	while (!m_token_stream.empty()) |  | ||||||
| 		m_token_stream.pop(); |  | ||||||
| 
 |  | ||||||
| 	if (token_type != Token::Type::EOF_) | 	if (token_type != Token::Type::EOF_) | ||||||
| 		return unexpected_token_error(token_type); | 		return unexpected_token_error(token_type); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue