mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-14 10:59:24 +02:00
Shell: Allow builtins and functions as conditions for 'if'
This commit is contained in:
committed by
Andreas Kling
parent
2b867ff555
commit
cd0ddf27f3
Notes:
sideshowbarker
2024-07-19 02:24:50 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/cd0ddf27f3e Pull-request: https://github.com/SerenityOS/serenity/pull/3473 Reviewed-by: https://github.com/bugaevc
@@ -591,10 +591,9 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int retval = 0;
|
||||
if (run_builtin(command, rewirings, retval)) {
|
||||
if (run_builtin(command, rewirings, last_return_code)) {
|
||||
for (auto& next_in_chain : command.next_chain)
|
||||
run_tail(next_in_chain, retval);
|
||||
run_tail(next_in_chain, last_return_code);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -610,9 +609,9 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
|
||||
}
|
||||
}
|
||||
|
||||
if (invoke_function(command, retval)) {
|
||||
if (invoke_function(command, last_return_code)) {
|
||||
for (auto& next_in_chain : command.next_chain)
|
||||
run_tail(next_in_chain, retval);
|
||||
run_tail(next_in_chain, last_return_code);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user