effekt-lang / effekt

A language with lexical effect handlers and lightweight effect polymorphism
https://effekt-lang.org
MIT License
334 stars 24 forks source link

Binary on Ubuntu 16.04 #16

Open b-studios opened 4 years ago

b-studios commented 4 years ago

On Ubuntu 16.04 it has been reported that Effekt cannot be exeucted since java -jar is treated as one command instead of a command and an argument.


The Effekt "binary" is created by prefixing:

#! /usr/bin/env java -jar

to the jar file itself. Installing it with npm makes the binary available (almost) platform independently. In particular on Windows, npm analyses the shebang and automatically generates scripts that correctly start Effekt by invoking java -jar.

We could change the shebang to

#! java -jar

which seems to work on MacOS X, Windows 10 and Ubuntu 16.04 -- however, now we cannot start Effekt as a subprocess from node. This is necessary to start the language server in the VSCode extension.

b-studios commented 4 years ago

I could also reproduce the bug on a fresh 18.04 VM:

$ effekt
/usr/bin/env: 'java -jar': No such file or directory
b-studios commented 4 years ago

As a workaround, one can of course run java -jar /usr/local/bin/effekt, but this is not satisfactory. However, getting vscode on Ubuntu to work is a bit more tricky since adjusting the path in the settings will not work for reasons similar to the ones described above.

b-studios commented 4 years ago

A more reliable workaround is the following:

Create a script effekt.sh with the following contents:

#!/bin/bash
java -jar /usr/bin/local/effekt $@

and make it executable. Put this script in your PATH and use effekt.sh instead of effekt. This also works for VSCode:

This solution also interacts well with updating the effekt package. Since the script only forwards to effekt, updating it under the hood just works.

b-studios commented 4 years ago

As a workaround I added the script to the distribution (87a4b0) and link it as effekt.sh. So linux users for now need to call effekt.sh instead of effekt. Also VSCode can now be configured to point to effekt.sh if effekt does not work.

b-studios commented 4 years ago

This needs to be documented on the website.

waterlens commented 2 years ago

So why not just pass -S to env to make it recognize the multiple arguments?

JonathanStarup commented 2 years ago

So why not just pass -S to env to make it recognize the multiple arguments?

This -S flag breaks on windows :(