cursive-ide / cursive

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

Respect IntelliJ PATH variables when running leiningen tasks #1568

Open darwin opened 8 years ago

darwin commented 8 years ago

It looks like PATH variables are not applied to all shell interactions done by Cursive

Shortly after opening a project with particular project.clj, the IDE reports unhandled exception. The problem is leiningen code choking on LEIN_SNAPSHOTS_IN_RELEASE error.

Recently I was forced to use a SNAPSHOT-dependency on specter library. This started those LEIN_SNAPSHOTS_IN_RELEASE issues. I could set LEIN_SNAPSHOTS_IN_RELEASE in my bash shell environment to silent it on command-line, but that does not apply to GUI apps like IntelliJ.app. Using PATH variables would be convenient here, but didn't work in this particular case. I had to resort to launchctl setenv LEIN_SNAPSHOTS_IN_RELEASE 1, which is global and does some magic. Once I set it I wasn't able to unsetenv-it. Maybe after restart? Anyways. I have a workaround to my particular issue.

In this report I'm asking for Cursive code review and making sure that all shell or leiningen library interactions respect PATH variables from IntelliJ.

macOS 10.12
Cursive 1.4.0-eap3-2016.3
IntelliJ IDEA 2016.3 EAP
Build #IU-163.6512.17, built on October 19, 2016
Expiration date: November 18, 2016
JRE: 1.8.0_112-release-b403 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

https://www.jetbrains.com/help/idea/2016.2/path-variables-2.html

darwin commented 8 years ago

Might be related to https://github.com/cursive-ide/cursive/issues/906.

metametadata commented 1 month ago

I have a similar issue with the custom Leiningen plugin which fires automatically and executes pnpm install.

This plugin is triggered as expected when Cursive IDE scans the projects. But it fails because pnpm cannot be found.

It turns out that the env vars, and PATH in particular, are not set as expected when the plugin is executed:

"PATH" "/usr/bin:/bin:/usr/sbin:/sbin"

On macOS pnpm can be installed via brew or npm (which in turn can be installed via nvm). So on dev machines pnpm actually can reside at /opt/homebrew/bin/pnpm or ~/.nvm/versions/node/v22.7.0/bin/pnpm and these paths are not on the PATH set by Cursive IDE.

This is probably a more general problem of IntelliJ IDE on macOS, looking at issues like https://youtrack.jetbrains.com/issue/IDEA-347122/PATH-in-terminal-doesnt-contain-some-of-configured-paths .