mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
Shell: Make the 'not' builtin return the correct exit code for functions
This commit is contained in:
parent
fec8d7d699
commit
4f6bf2931c
1 changed files with 5 additions and 0 deletions
|
@ -892,10 +892,15 @@ int Shell::builtin_not(int argc, const char** argv)
|
|||
|
||||
auto commands = expand_aliases({ move(command) });
|
||||
int exit_code = 1;
|
||||
auto found_a_job = false;
|
||||
for (auto& job : run_commands(commands)) {
|
||||
found_a_job = true;
|
||||
block_on_job(job);
|
||||
exit_code = job.exit_code();
|
||||
}
|
||||
// In case it was a function.
|
||||
if (!found_a_job)
|
||||
exit_code = last_return_code;
|
||||
return exit_code == 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue