summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry <dmitry.polyanovsky@gmail.com>2018-04-23 22:34:40 +0300
committerDmitry <dmitry.polyanovsky@gmail.com>2018-04-23 22:34:40 +0300
commitc22fde17a7a30cee5e3e5e04fab187eed2ecfe42 (patch)
tree416339ace76ec83c9093b5a8353db9bc0bd5ab14 /src
parentb3f99aa42fcbeffa8751df308cb194a470cd0e80 (diff)
fix & test
Diffstat (limited to 'src')
-rw-r--r--src/rebar_file_utils.erl8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl
index 0dbc40a..492d690 100644
--- a/src/rebar_file_utils.erl
+++ b/src/rebar_file_utils.erl
@@ -191,8 +191,12 @@ cp_r(Sources, Dest) ->
{unix, _} ->
EscSources = [rebar_utils:escape_chars(Src) || Src <- Sources],
SourceStr = rebar_string:join(EscSources, " "),
- {ok, []} = rebar_utils:sh(?FMT("mkdir -p \"~ts\" && cp -Rp ~ts $_",
- [rebar_utils:escape_double_quotes(Dest), SourceStr]),
+ % ensure destination exists before copying files into it
+ {ok, []} = rebar_utils:sh(?FMT("mkdir -p ~ts",
+ [rebar_utils:escape_chars(Dest)]),
+ [{use_stdout, false}, abort_on_error]),
+ {ok, []} = rebar_utils:sh(?FMT("cp -Rp ~ts \"~ts\"",
+ [SourceStr, rebar_utils:escape_double_quotes(Dest)]),
[{use_stdout, false}, abort_on_error]),
ok;
{win32, _} ->