1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:57:35 +00:00

Shell: Make 'if' expressions return the unevaluated value of blocks

This makes it possible to actually put them in a sequence and cast them
to commands.
This commit is contained in:
AnotherTest 2021-01-18 10:06:13 +03:30 committed by Andreas Kling
parent 50473003be
commit 5ec139e728
3 changed files with 14 additions and 4 deletions

View file

@ -730,7 +730,12 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
}
}
if (command.argv.is_empty() && !command.next_chain.is_empty() && command.should_immediately_execute_next && command.next_chain.first().node->should_override_execution_in_current_process()) {
if (command.argv.is_empty()
&& !command.next_chain.is_empty()
&& command.should_immediately_execute_next
&& command.redirections.is_empty()
&& command.next_chain.first().node->should_override_execution_in_current_process()) {
for (auto& next_in_chain : command.next_chain)
run_tail(command, next_in_chain, last_return_code);
return nullptr;