summaryrefslogtreecommitdiff
path: root/Userland/Shell
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Shell')
-rw-r--r--Userland/Shell/Builtin.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Shell/Builtin.cpp b/Userland/Shell/Builtin.cpp
index 3b1cb9db33..1eada40364 100644
--- a/Userland/Shell/Builtin.cpp
+++ b/Userland/Shell/Builtin.cpp
@@ -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;
}