Skip to content

Commit d828966

Browse files
rktjmpmhanberg
andauthored
fix: trim any quotes wrapping PATH when elixir is managed by mise (#82)
When Expert.Port detects the elixir executable, it extracts the current env from mise/rtx if present, by calling `mise env -s bash`. This returns ... export PATH='<path>' ... If we don't strip the surrounding single quotes, later when we re-inject `PATH` into the environmetn, `sh` will fail to intepret it correctly, meaning future calls to any `mise` managed executables such as `erl` will fail as a command not found. This will then cause servers to fail to load and bubble an `{:erpc, :noconnection}` error up to the user. #59 (comment) Co-authored-by: Mitchell Hanberg <mitch@mitchellhanberg.com>
1 parent 633280a commit d828966

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

apps/expert/lib/expert/port.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ defmodule Expert.Port do
8787
key_and_value
8888
|> String.split("=", parts: 2)
8989
|> Enum.map(&String.trim/1)
90+
|> then(fn
91+
["PATH", path] -> ["PATH", String.trim(path, "'")]
92+
other -> other
93+
end)
9094

9195
{key, value}
9296

@@ -108,6 +112,10 @@ defmodule Expert.Port do
108112
key_and_value
109113
|> String.split("=", parts: 2)
110114
|> Enum.map(&String.trim/1)
115+
|> then(fn
116+
["PATH", path] -> ["PATH", String.trim(path, "'")]
117+
other -> other
118+
end)
111119

112120
{key, value}
113121

0 commit comments

Comments
 (0)