summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuis Rascão <luis.rascao@gmail.com>2015-10-12 13:48:09 +0100
committerLuis Rascão <luis.rascao@gmail.com>2015-10-25 15:20:53 +0000
commitea84fdaf31fddab55ba3d9630710b21e5db209bc (patch)
treee7591d73546a068c34d22a72fcd3e895e9877b0e /src
parentb870e061a3038039e1721723b17c8e8cd27b82b5 (diff)
downloadrebar-ea84fdaf31fddab55ba3d9630710b21e5db209bc.tar.gz
Fix windows eunit tests
File tests: windows file operations should abort on error the same as unix operations invoked through sh. Also windows does not support the '?' character in filenames. Eunit tests: the 'All' prefix is missing on the 'x tests passed' message. Eunit only prints the 'All' prefix if there are more than 2 passed tests, dropping the prefix on the match works for all cases.
Diffstat (limited to 'src')
-rw-r--r--src/rebar_file_utils.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl
index 0fc1403..a4d3be7 100644
--- a/src/rebar_file_utils.erl
+++ b/src/rebar_file_utils.erl
@@ -88,7 +88,7 @@ mv(Source, Dest) ->
?FMT("move /y \"~s\" \"~s\" 1> nul",
[filename:nativename(Source),
filename:nativename(Dest)]),
- [{use_stdout, false}, return_on_error]),
+ [{use_stdout, false}, abort_on_error]),
case R of
[] ->
ok;
@@ -131,14 +131,14 @@ delete_each_dir_win32([]) -> ok;
delete_each_dir_win32([Dir | Rest]) ->
{ok, []} = rebar_utils:sh(?FMT("rd /q /s \"~s\"",
[filename:nativename(Dir)]),
- [{use_stdout, false}, return_on_error]),
+ [{use_stdout, false}, abort_on_error]),
delete_each_dir_win32(Rest).
xcopy_win32(Source,Dest)->
{ok, R} = rebar_utils:sh(
?FMT("xcopy \"~s\" \"~s\" /q /y /e 2> nul",
[filename:nativename(Source), filename:nativename(Dest)]),
- [{use_stdout, false}, return_on_error]),
+ [{use_stdout, false}, abort_on_error]),
case length(R) > 0 of
%% when xcopy fails, stdout is empty and and error message is printed
%% to stderr (which is redirected to nul)
@@ -162,8 +162,10 @@ cp_r_win32({false, Source} = S,{true, DestDir}) ->
cp_r_win32(S, {false, filename:join(DestDir, filename:basename(Source))});
cp_r_win32({false, Source},{false, Dest}) ->
%% from file to file
- {ok,_} = file:copy(Source, Dest),
- ok;
+ case file:copy(Source, Dest) of
+ {ok,_} -> ok;
+ _ -> throw(rebar_abort)
+ end;
cp_r_win32({true, SourceDir}, {false, DestDir}) ->
case filelib:is_regular(DestDir) of
true ->