mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:47:45 +00:00
Shell: Don't reset 'last_return_code' before running commands
Some variables depend on its value to function correctly. Fixes the following issue: $ false; echo $? 1 $ false $ echo $? 128
This commit is contained in:
parent
689fe7ddff
commit
310a18da1e
4 changed files with 20 additions and 18 deletions
|
@ -1059,7 +1059,7 @@ int Shell::builtin_not(int argc, const char** argv)
|
|||
}
|
||||
// In case it was a function.
|
||||
if (!found_a_job)
|
||||
exit_code = last_return_code;
|
||||
exit_code = last_return_code.value_or(0);
|
||||
return exit_code == 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue