KronicDeth / intellij-elixir

Elixir plugin for JetBrain's IntelliJ Platform (including Rubymine)
Other
1.84k stars 154 forks source link

Cannot Detect SDK Version when using conda package manager #489

Open inkblot opened 8 years ago

inkblot commented 8 years ago

When I follow the directions in the README for adding an SDK that was not auto-detected, I get the error dialog with title "Cannot Detect SDK Version" and message "Probably SDK installed in '/path/to/sdk/lib/elixir' is corrupt. In the idea.log I see this stack trace:

java.lang.IllegalArgumentException: Must specify non-empty 'commandLine' parameter
        at com.intellij.execution.process.BaseOSProcessHandler.<init>(BaseOSProcessHandler.java:65)
        at com.intellij.execution.process.OSProcessHandler.<init>(OSProcessHandler.java:68)
        at com.intellij.execution.process.CapturingProcessHandler.<init>(CapturingProcessHandler.java:58)
        at com.intellij.execution.process.CapturingProcessHandler.<init>(CapturingProcessHandler.java:45)
        at org.elixir_lang.sdk.ElixirSystemUtil.execute(ElixirSystemUtil.java:95)
        at org.elixir_lang.sdk.ElixirSystemUtil.getProcessOutput(ElixirSystemUtil.java:85)
        at org.elixir_lang.sdk.ElixirSystemUtil.transformStdoutLine(ElixirSystemUtil.java:61)
        at org.elixir_lang.sdk.ElixirSdkType.detectSdkVersion(ElixirSdkType.java:190)
        at org.elixir_lang.sdk.ElixirSdkType.getRelease(ElixirSdkType.java:230)
KronicDeth commented 8 years ago
inkblot commented 8 years ago

Plugin: version 4.4.0 OS: Ubuntu 14.04

Elixir: Installed version 1.3.0 using conda in a path like ~/conda/envs/environment_name which contains the Elixir SDK in lib/elixir and Erlang in lib/erlang, with symlinks to executables in bin.

SDK path: The .../lib/elixir directory which contains bin/{elixir,elixirc,iex,mix}.

Some contextual information from a basic unadulterated shell:

~/conda/envs/scratch $ echo $PS1
\w $ 
~/conda/envs/scratch $ ls -1 lib/elixir/bin
elixir
elixirc
iex
mix
~/conda/envs/scratch $ which elixir
~/conda/envs/scratch $ which erl
~/conda/envs/scratch $ file bin/elixir
/home/inkblot/conda/envs/scratch/bin/elixir: symbolic link to '../lib/elixir/bin/elixir'
~/conda/envs/scratch $ file bin/erl
/home/inkblot/conda/envs/scratch/bin/erl: symbolic link to '../lib/erlang/bin/erl'
~/conda/envs/scratch $ bin/elixir -v
bin/elixir: 126: exec: erl: not found

And after "entering" the conda environment:

~/conda/envs/scratch $ source activate scratch
discarding /home/inkblot/conda/bin from PATH
prepending /home/inkblot/conda/envs/scratch/bin to PATH
~/conda/envs/scratch $ which elixir
/home/inkblot/conda/envs/scratch/bin/elixir
~/conda/envs/scratch $ which erl
/home/inkblot/conda/envs/scratch/bin/erl
~/conda/envs/scratch $ elixir -v
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:12:12] [async-threads:10] [hipe] [kernel-poll:false]

Elixir 1.3.0
~/conda/envs/scratch $ mix --version
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:12:12] [async-threads:10] [hipe] [kernel-poll:false]

Mix 1.3.0

It seems like what's needed is a way to detect that this SDK is in a conda environment and infer what the PATH for the environment would be after activation.