@@ -36,49 +36,48 @@ defmodule Expert.Port do
3636 end
3737
3838 def elixir_executable ( % Project { } = project ) do
39- case :os . type ( ) do
40- { :win32 , _ } ->
41- # Remove the burrito binaries from PATH
42- path =
43- "PATH"
44- |> System . get_env ( )
45- |> String . split ( ";" , parts: 2 )
46- |> List . last ( )
47-
48- case :os . find_executable ( ~c" elixir" , to_charlist ( path ) ) do
49- false ->
50- { :error , :no_elixir , "Couldn't find an elixir executable" }
51-
52- elixir ->
53- env =
54- Enum . map ( System . get_env ( ) , fn
55- { "PATH" , _path } -> { "PATH" , path }
56- other -> other
57- end )
58-
59- { :ok , elixir , env }
60- end
61-
62- _ ->
63- root_path = Project . root_path ( project )
64-
65- shell = System . get_env ( "SHELL" )
66- path = path_env_at_directory ( root_path , shell )
67-
68- case :os . find_executable ( ~c" elixir" , to_charlist ( path ) ) do
69- false ->
70- { :error , :no_elixir ,
71- "Couldn't find an elixir executable for project at #{ root_path } . Using shell at #{ shell } with PATH=#{ path } " }
72-
73- elixir ->
74- env =
75- Enum . map ( System . get_env ( ) , fn
76- { "PATH" , _path } -> { "PATH" , path }
77- other -> other
78- end )
79-
80- { :ok , elixir , env }
81- end
39+ if Forge.OS . windows? do
40+ # Remove the burrito binaries from PATH
41+ path =
42+ "PATH"
43+ |> System . get_env ( )
44+ |> String . split ( ";" , parts: 2 )
45+ |> List . last ( )
46+
47+ case :os . find_executable ( ~c" elixir" , to_charlist ( path ) ) do
48+ false ->
49+ { :error , :no_elixir , "Couldn't find an elixir executable" }
50+
51+ elixir ->
52+ env =
53+ Enum . map ( System . get_env ( ) , fn
54+ { "PATH" , _path } -> { "PATH" , path }
55+ other -> other
56+ end )
57+
58+ { :ok , elixir , env }
59+ end
60+
61+ else
62+ root_path = Project . root_path ( project )
63+
64+ shell = System . get_env ( "SHELL" )
65+ path = path_env_at_directory ( root_path , shell )
66+
67+ case :os . find_executable ( ~c" elixir" , to_charlist ( path ) ) do
68+ false ->
69+ { :error , :no_elixir ,
70+ "Couldn't find an elixir executable for project at #{ root_path } . Using shell at #{ shell } with PATH=#{ path } " }
71+
72+ elixir ->
73+ env =
74+ Enum . map ( System . get_env ( ) , fn
75+ { "PATH" , _path } -> { "PATH" , path }
76+ other -> other
77+ end )
78+
79+ { :ok , elixir , env }
80+ end
8281 end
8382 end
8483
@@ -123,7 +122,7 @@ defmodule Expert.Port do
123122 Launches an executable in the project context via a port.
124123 """
125124 def open ( % Project { } = project , executable , opts ) do
126- { os_type , _ } = :os . type ( )
125+ { os_type , _ } = Forge.OS . type ( )
127126
128127 opts =
129128 opts
@@ -158,7 +157,7 @@ defmodule Expert.Port do
158157 Provides the path of an executable to launch another erlang node via ports.
159158 """
160159 def path do
161- path ( :os . type ( ) )
160+ path ( Forge.OS . type )
162161 end
163162
164163 def path ( { :unix , _ } ) do
0 commit comments