Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions apps/expert/lib/expert/port.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,25 @@ defmodule Expert.Port do
shell = System.get_env("SHELL")

{path, 0} = System.cmd(shell, ["-i", "-l", "-c", "cd #{root_path} && echo $PATH"])
elixir = :os.find_executable(~c"elixir", to_charlist(path))

env =
Enum.map(System.get_env(), fn
{"PATH", _path} -> {"PATH", path}
other -> other
end)
case :os.find_executable(~c"elixir", to_charlist(path)) do
false ->
GenLSP.error(
Expert.get_lsp(),
"Couldn't find an elixir executable for project at #{root_path}. Using shell at #{shell} with PATH=#{path}"
)

{:error, :no_elixir}

{:ok, elixir, env}
elixir ->
env =
Enum.map(System.get_env(), fn
{"PATH", _path} -> {"PATH", path}
other -> other
end)

{:ok, elixir, env}
end
end

@doc """
Expand Down
Loading