summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2018-10-18 15:38:48 -0400
committerFred Hebert <mononcqc@ferd.ca>2018-10-18 15:45:00 -0400
commitc9fbb4a44feac75a325c5831293901d5cb12075a (patch)
tree5583dece572108bb4b038961ad34e78398498c06 /src
parent7bfc8110d1736d2cbf61e19d2fc16dc8e854b460 (diff)
Fix shell hook expansion on windows
Dollar Variable expansion (`$VAR`) was inadvertently disabled for windows variables, although %VARIABLES% already worked. This reduced the portability of hooks in general. Additionally, tests would fail on windows due to bad quoting of paths: the path C:/a/b/c would fail when passed to the command `cmd /q /c C:/a/b/c` because it would interpret /a /b and /c as 3 options. Using quotes makes the tests pass.
Diffstat (limited to 'src')
-rw-r--r--src/rebar_utils.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 1769b79..11add61 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -156,7 +156,7 @@ sh_send(Command0, String, Options0) ->
Options = [expand_sh_flag(V)
|| V <- proplists:compact(Options0 ++ DefaultOptions)],
- Command = lists:flatten(patch_on_windows(Command0, proplists:get_value(env, Options, []))),
+ Command = lists:flatten(patch_on_windows(Command0, proplists:get_value(env, Options0, []))),
PortSettings = proplists:get_all_values(port_settings, Options) ++
[exit_status, {line, 16384}, use_stdio, stderr_to_stdout, hide],
Port = open_port({spawn, Command}, PortSettings),
@@ -187,7 +187,7 @@ sh(Command0, Options0) ->
ErrorHandler = proplists:get_value(error_handler, Options),
OutputHandler = proplists:get_value(output_handler, Options),
- Command = lists:flatten(patch_on_windows(Command0, proplists:get_value(env, Options, []))),
+ Command = lists:flatten(patch_on_windows(Command0, proplists:get_value(env, Options0, []))),
PortSettings = proplists:get_all_values(port_settings, Options) ++
[exit_status, {line, 16384}, use_stdio, stderr_to_stdout, hide, eof],
?DEBUG("Port Cmd: ~ts\nPort Opts: ~p\n", [Command, PortSettings]),