crystal-lang / crystal

The Crystal Programming Language
https://crystal-lang.org
Apache License 2.0
19.49k stars 1.62k forks source link

Add compiler path to `$PATH` for subcommands #15186

Open straight-shoota opened 1 week ago

straight-shoota commented 1 week ago

Resolves #15145

straight-shoota commented 1 week ago

I dropped the test code for exit_code because it was failing on Windows. It was unrelated to this change anyway. I'll investigate further and add it in a follow-up.

bcardiff commented 1 week ago

An upside of the $CRYSTAL env variable is that if the compiler is not crystal but something else crystal-1.0, crystal-1.14, crystal-2 then the external commands still works.

I don't mind prepending to the $PATH and having a $CRYSTAL_EXEC_PATH, but I don't see how we enable binaries named differently.

$CRYSTAL is also used in shards as a convention, so I thought it was convenient to keep the same pattern. (which happens to be the same as in cabal with $CABAL)

bcardiff commented 1 week ago

If no one thinks that supporting different names of the compiler binary is needed then 👍

RX14 commented 6 days ago

The interface between the compiler and extension scripts is likely to be a long-lived interface, so I think it's worth spending the time to get it working when the compiler isn't named just crystal. This PR is an improvement already, but I think using $CRYSTAL is a good thing to encourage.