Skip to content

Commit 774a373

Browse files
committed
[core] Clear PATH cache on 'setglobal PATH'
Both SetNamedYsh and SetNamed need to have this hack - the former is invoked in osh with 'setglobal PATH', the latter with 'PATH=' Signed-off-by: Andrii Sultanov <[email protected]>
1 parent 1cc4e3b commit 774a373

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/state.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,6 +1993,11 @@ def SetNamedYsh(self, lval, val, which_scopes, flags=0):
19931993
assert flags & SetNameref == 0, flags
19941994
assert flags & ClearNameref == 0, flags
19951995

1996+
# Hack: let SearchPath know it needs to reset the path
1997+
# cache before looking up a command
1998+
if lval.name == 'PATH':
1999+
self.clear_path_cache = True
2000+
19962001
cell, var_frame = self._ResolveNameForYshMutation(
19972002
lval.name, which_scopes, bool(flags & YshDecl))
19982003

0 commit comments

Comments
 (0)