mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:27:35 +00:00
Shell: Refresh PATH cache after 'unset PATH'
Note that `execvp` has a default value for PATH (both on Serenity and on Linux) and so this does not 'fix' #11608.
This commit is contained in:
parent
310a18da1e
commit
6a245de911
1 changed files with 7 additions and 0 deletions
|
@ -1028,7 +1028,11 @@ int Shell::builtin_unset(int argc, const char** argv)
|
|||
if (!parser.parse(argc, const_cast<char**>(argv), Core::ArgsParser::FailureBehavior::PrintUsage))
|
||||
return 1;
|
||||
|
||||
bool did_touch_path = false;
|
||||
for (auto& value : vars) {
|
||||
if (!did_touch_path && value == "PATH"sv)
|
||||
did_touch_path = true;
|
||||
|
||||
if (lookup_local_variable(value)) {
|
||||
unset_local_variable(value);
|
||||
} else {
|
||||
|
@ -1036,6 +1040,9 @@ int Shell::builtin_unset(int argc, const char** argv)
|
|||
}
|
||||
}
|
||||
|
||||
if (did_touch_path)
|
||||
cache_path();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue