Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is sbt quitting when using fish?

Tags:

scala

sbt

fish

I'm trying to get sbt running using the fish shell.

#!/usr/local/bin/fish 
java -Xmx512M -jar (dirname (status -f))/sbt-launch-0.7.4.jar "$argv"

When I call sbt I get the following

[info] Building project MyProject 1.0 against Scala 2.8.1
[info]    using MyProject with sbt 0.7.4 and Scala 2.7.7
[info] 
[info] Total session time: 1 s, completed Dec 19, 2010 4:29:46 PM
[success] Build completed successfully.

Then sbt quits. Why? Shouldn't it just wait for commands?

On a possibly related note, I'm sure I didn't used to have to do #![shell] on the first line when I was using bash. What's changed?

UPDATE: When writing the equivalent script to use bash everything works fine, sbt doesn't do a build then quit

#!/bin/bash
java -Xmx512M -jar `dirname $0`/sbt-launch-0.7.4.jar "$@"
like image 576
Pengin Avatar asked Dec 19 '10 16:12

Pengin


2 Answers

If you don't use a shebang (#!/usr/local/bin/fish in your example), a script will run with the default shell on your system, which is likely /bin/sh.

If you run your script using #!/bin/sh or #!/bin/bash does it work the way you expect it to?

There's nothing in your script that should affect how things work differently from other shells. I don't understand how your script relates to what you're doing (mostly because I'm unfamiliar with sbt). What is the name of your script? How is it called? How are you calling sbt?

like image 97
Dennis Williamson Avatar answered Nov 21 '22 19:11

Dennis Williamson


Looks like you're running the shell as a script, not a shell. Fish will just run your java command and then exit.

Take the bang out of that script and make it executable and you can just run it as

/path/to/fish /path/to/script

I believe.

like image 45
JohnMetta Avatar answered Nov 21 '22 20:11

JohnMetta