-
-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ammonite not working under fish shell #813
Comments
Found the issue here, https://github.com/lihaoyi/mill/blob/master/main/src/mill/modules/Jvm.scala Going to submit a PR on mill. Once the PR is merged and mill is released I can submit a fix here on ammonite |
@mdedetrich did you install Ammonite using the command below? It's meant to prepend the shebang for you: sudo sh -c '(echo "#!/usr/bin/env sh" && curl -L https://github.com/lihaoyi/Ammonite/releases/download/1.1.2/2.12-1.1.2) > /usr/local/bin/amm && chmod +x /usr/local/bin/amm' && amm Note that the command for the stable-version installation was incorrect until recently (yesterday?) and I just corrected it |
@lihaoyi I installed ammonite via homebrew, here is the formula https://github.com/Homebrew/homebrew-core/blob/master/Formula/ammonite-repl.rb The formula literally just downloads the zip and extracts it, is it possible to update it? |
@mdedetrich sure send a PR to homebrew |
@lihaoyi Can you please provide a release download that includes the shebang line? That's not the kind of logic that belongs in the Homebrew formula. Thanks! |
@lihaoyi I agree with @ilovezfs , can you re-open the ticket and let me know when mill is released with the fix that was merged yesterday (i.e. com-lihaoyi/mill#338)? I can then send a PR that properly adds the shebang as well as updating the documentation. |
@mdedetrich done; you'll probably need to make it fall back to uploading separate windows/bash artifacts in that case, since the goal of removing the shebang line was to try and unify the two scripts (#789) (CC @robby-phd since IIRC you wrote the batch file prefix) |
FWIW whatever solution we come up for this will also probably need to be ported to the Mill launcher script, which shares the same problem |
What if we always appended the shebang line? This would cause an error message on windows. |
The thing is, ideally you should be making different targets for different platforms, this is what sbt-native-packager does (it creates a launcher for windows and one for *nix) @lihaoyi What I have in mind is to create launchers in a seperate folders. So there will be one folder which will be called What do you think? |
While I think it's ideal to have separate packages for different platforms, in this case, the only difference is a single shebang line for specific shells such as fish, ksh, etc.; so it is a matter of uploading tens of MBs for every commit of amm (and mill) with just a single line that differs. Granted, GitHub does not put a limit on release sizes now, but it seems like a waste to me. I don't use homebrew so I'm not familiar with it, but perhaps a compromise would be to change the installation setup for homebrew+fish/ksh/etc. users to something like the following (someone can figure the a single line command for this, I'm sure):
For example, the setup instruction for Cygwin provides a sed command to modify the path to use cygdrive, and it's used for testing mill under Cygwin in AppVeyor. (This compromise works if homebrew does not detect integrity of installed files via hashing when running certain tasks and decides it should reinstall stuff.) |
@robby-phd In general, the homebrew guys aren't really happy with modifying files directly unless strictly necessary, their argument is that this should be fixed upstream (see Homebrew/homebrew-core#28053 (comment) for more info). I would also comment in that thread if you want to convince the homebrew guys that you really don't want to make a separate distribution just for nix. From what I know, if you wan't to be really strict about not making separate distributions, technically I would have to use homebrews |
My suggestion is to have an installation script in the zip file that takes a prefix parameter.
or
and then it can do whatever magic is necessary, and we'll happily run
in the formula. |
@mdedetrich I'm well aware of the discussion in Homebrew/homebrew-core#28053 (comment) before responding, hence my suggestion to take the unsanctioned logic out of homebrew hoping that it might work. It's not that I want to be strict about having only one distribution, IMO, I just don't think a single line diff as a strong justification to complicate things for everyone, especially if there is a simple workaround on the specifically affected user side. Anyway, if either the patch or the install script works, then that sounds like a better option. |
Using |
Also encountered this when I installed Using this configuration |
Why not have just two separate launchers? One for unix/linux, written in sh or bash, with the appropriate shebang line included. One for windows, written in ? |
@tonylotts I agree with you. That's what all other tools/apps like maven, gradle, tomcat do. |
Sorry I don't follow the thread--should people who use fish just reinstall ammonite without brew? |
@patrick-premont If you do this then you would have to manually edit the launcher in ammonite to add the Personally I just run |
I use a custom
|
Thanks @swiesner-dlr . Works for me! |
Looks like this issue is fixed now, as your PR has been merged and released, right @mdedetrich ? |
Is this still needed? Does ammonite now work w/o this script in fish shell? |
It seems to work for me well without any workarounds on Fish 3.2.2 and Ammonite 2.4.0. (I did experience this issue before, but at some point it disappeared) |
Excellent. Will delete my wrapper script. Thanks @laughedelic. |
@lihaoyi it appears this can be closed. $ echo $SHELL
/usr/local/bin/fish
$ amm
Loading...
Welcome to the Ammonite Repl 2.3.8 (Scala 2.13.3 Java 1.8.0_275)
@ 1 + 2
res0: Int = 3
@ |
When running Ammonite under fish shell, you get the following
The issue is that you don't specify under what shell to run Ammonite under, i.e. if I edit the shell script to start ammonite, I see
It instead should have the shebang, i.e. something like
The text was updated successfully, but these errors were encountered: