Closed edwintorok closed 1 month ago
It might be difficult to automatically modify the user's PATH (there could be a lot of other things than return 0
that could prevent the last line from being executed), but one improvement the dune installer could do is to verify whether the PATH modification worked, and if it didn't ask the user to check that the script didn't exit early.
One way to test that is:
zsh -i -c 'echo $PATH'
And then check that the newly installed dune is really the first one found in that PATH (and e.g. that opam or something else didn't override it)
(note the -i
for interactive shell, if you just do zsh -l -c 'echo $PATH'
or zsh -c 'echo $PATH'
, then it wouldn't work without also modifying .zshenv
).
As this issue is related to the distribution of the preview version of dune
and not about dune
itself, I move it to https://github.com/ocaml-dune/binary-distribution. @edwintorok I have reposted your question here: https://github.com/ocaml-dune/binary-distribution/issues/85.
Expected Behavior
Actual Behavior
Reproduction
You can find my full ZSH config here: https://gitlab.com/edwintorok/dotfiles/-/tree/master/zsh?ref_type=heads
However for the purposes of this bug you can repro it with:
opam install dune
echo 'return 0' >.zshrc
curl https://dune.ci.dev/install | bash
1.zsh -l
dune --version
echo $PATH
Specifications
dune
(output ofdune --version
): 3.16.0ocaml
(output ofocamlc --version
): 5.2.0Additional information
Dune added this to my .zshrc, but that has no effect
If I instead I add it to
.zshenv
it is better, but still in the wrong place (opam takes precedence):The reason it doesn't work in
.zshrc
because mine ends like this:So I need to move the
export PATH
before the 'return 0', so this works: