JuliaLang / juliaup

Julia installer and version multiplexer
MIT License
931 stars 82 forks source link

Add julia to path immediately #462

Open LilithHafner opened 1 year ago

LilithHafner commented 1 year ago

The extra step of reloading the shell or re-executing a startup file seems unnecessary to me.

This is especially important for scripts using juliaup via expect. It would be nice to not have to do shell detection and pick which startup file to execute.

Additionally, some folks' startup files may not behave well when run repeatedly as julaup currently recommends.

x@X ~ % curl -fsSL https://install.julialang.org | sh
...
Julia was successfully installed on your system.

Depending on which shell you are using, run one of the following
commands to reload the the PATH environment variable:

  . /Users/x/.profile
  . /Users/x/.bash_profile
  . /Users/x/.zshrc

x@X ~ % julia
zsh: command not found: julia
davidanthoff commented 1 year ago

The question is how we would do this :) The installation logic is all in juliainstaller binary and I don't think one can "inject" or modify env variables in the parent process, right?

LilithHafner commented 1 year ago

Would changing the primary invocation to . <(curl -fsSL https://install.julialang.org | sh) work? juliainstaller would need to produce PATH=... as its output.

It should also be possible to make the primary invocation . <(curl -fsSL https://install.julialang.org), but that may take more work.

Demo

x@X ~ % . <(echo PTHH=$PATH)     
x@X ~ % echo $PTHH
/Users/x/.julia/juliaup/bin:/Library/Framewo...
davidanthoff commented 1 year ago

I'm not sure. The current version of the shell script is simply copied from rustup. As far as I can tell there are quite a few quirks in there to make sure it works on as many systems as possible, so I'd be a bit hesitant to make larger changes at this point, it would really require that we then test that thoroughly on all sorts of systems...

LilithHafner commented 1 year ago

Do we have CI for this or would it need to be manually tested?

davidanthoff commented 1 year ago

It would all be manual tests. This is the kind of thing where it is very easy to get it right for 90% of systems/users (and that includes the systems we have on CI), and then there is this very, very long tail of weirdly configured systems where things also need to work. I'm sure rustup just accumulated bug fixes over many years to arrive at the current version of the script, and in many ways we are just benefitting from their experience, probably without even being aware of all the quirks they are dealing with :)

fingolfin commented 5 months ago

A major issue with . <(curl -fsSL https://install.julialang.org | sh) is that it wouldn't work in every shell, unless one took great care to detect say zsh vs. bash vs fish vs tcsh vs ... -- I actually don't see a way to do that at all, but of course that just shows my fantasy is limited :-)