Use String.to_char_list when converting shell commands

We have found this bug as rebar failed to compile projects
with non-latin characters on the path. Using String.to_char_list
performs the proper conversion, passing the proper arguments
to rebar.
This commit is contained in:
José Valim
2015-10-30 11:30:05 -02:00
parent 4a0b64886d
commit 8fd3eb5a2c
+2 -2
View File
@@ -111,11 +111,11 @@ defmodule Mix.Shell do
{:unix, _} ->
command = command
|> String.replace("\"", "\\\"")
|> :binary.bin_to_list
|> String.to_char_list
'sh -c "' ++ command ++ '"'
{:win32, osname} ->
command = :binary.bin_to_list(command)
command = String.to_char_list(command)
case {System.get_env("COMSPEC"), osname} do
{nil, :windows} -> 'command.com /c ' ++ command
{nil, _} -> 'cmd /c ' ++ command