cursive-ide / cursive

Cursive: The IDE for beautiful Clojure code
588 stars 7 forks source link

Error reading project.clj with lein-version-script plugin #2666

Open vatchedj opened 2 years ago

vatchedj commented 2 years ago

I'm working on a project that uses the lein-version-script plugin. The project.clj contains a :version-script key with the value "cat VERSION". VERSION is a file that exists in both the root of the project and in the resources folder.

When I start IntelliJ or Refresh Leiningen Projects, I get the error "Error reading /project.clj: External script in :version-script failed with exit code 1".

If I comment out :version-script or add :middleware false to the lein-version-script plugin entry in my project file, I'm able to load the project, but I believe this would disable desired behavior. Most others on my team use Emacs/Spacemacs and don't run into this issue.

Is there a way to know specifically what lein command is run by the Refresh Leiningen Projects operation so I can reproduce this from the command line?

elliotcourant commented 2 years ago

It looks like the :version-script is not being executed in the working directory of the project.

If I change the script to be:

  :version-script "echo $PWD > ~/debug.txt"

and then I look at the file it creates:

$ cat ~/debug.txt
/

It's running in the root directory of the file system, not in the project directory.