xerial / sbt-pack

A sbt plugin for creating distributable Scala packages.
496 stars 76 forks source link

Lauch Script depends on 'which', non-graceful termination when it's missing #425

Closed KevinAtSesam closed 5 months ago

KevinAtSesam commented 1 year ago

Through trial and error, I discovered that one of the images we use in our services does not come pre-packed with which. While this is a minor inconvenience to change, it took me the better part of a day to realise, that the launch script fails because of that.

Since which is essential for the launch script to function, I wish to ask you to include an error message when which is not available.

Could be as simple as

if ! command -v which &> /dev/null
then
    echo "'which' could not be found"
    exit
fi

Launch script

https://github.com/xerial/sbt-pack/blob/master/src/main/twirl/xerial/sbt/pack/launch.scala.txt

KevinAtSesam commented 1 year ago

Reading more on the topic, which is not recommended and it would be better to use the POSIX compliant build-in command -v

https://stackoverflow.com/a/677212

xerial commented 5 months ago

Released sbt-pack 0.20 with this fix. Thanks!