Open egnor opened 8 months ago
this may be the root cause why the "short circuiting" logic isn't working in https://github.com/jdx/mise/issues/1617. I have not investigated but I suspect the short circuiting logic is still incorrectly calling the env var directives are being executed somewhere.
Describe the bug When the script referenced by an
env._.source
field changes, the environment doesn't update, even though the sourced script definitely gets re-executed.To Reproduce This appears to be order dependent so make sure to follow these steps exactly as so:
(press control-D, then continue:)
(control-D again, then:)
Expected behavior Before
add_to_env.sh
exists, there should be a "No such file or directory" error.$ADDED_IN_MISE_TOML
should be set, but$ADDED_IN_SOURCED_FILE
should not, and$PATH
should be untouched.After
add_to_env.sh
is created, the output from that script ("In add_to_env.sh: ...") should appear,$ADDED_IN_SOURCED_FILE
should be set in the shell environment, and$PATH
should have a prefix added. Changing out and back into the directory should have no effect.Actual behavior Indeed, after
.mise.toml
is created but beforeadd_to_env.sh
exists, everything is as expected:However, after creating
add_to_env.sh
, things are strange:So even though the script is clearly run (per the
In add_to_env.sh: ...
lines),$ADDED_IN_SOURCED_FILE
is not set and$PATH
is not modified. Upon changing out and back in, things change a bit:So now the script is being run twice (for some reason) and this time
$ADDED_IN_SOURCED_FILE
is being set, but$PATH
is still not being updated even though the script changes it.mise doctor
outputAdditional context I believe this also happens if the sourced script is modified to change which variables are exported, not just when it was missing and is created, but I haven't explored all the permutations.