aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2011-09-29 19:00:41 +0200
committerPatrik Nyblom <[email protected]>2011-12-07 08:21:17 +0100
commit62369833ca4e26dd12a8a7795dd1a69f39d7c57d (patch)
treecc531f9a82d90518fcae8d6c17b7230f26602521 /lib
parent6b31de5969abeb37f7d8d43815a236abadb42508 (diff)
downloadotp-62369833ca4e26dd12a8a7795dd1a69f39d7c57d.tar.gz
otp-62369833ca4e26dd12a8a7795dd1a69f39d7c57d.tar.bz2
otp-62369833ca4e26dd12a8a7795dd1a69f39d7c57d.zip
Teach os_SUITE:space_in_name to quote correctly on Windows
Diffstat (limited to 'lib')
-rw-r--r--lib/kernel/test/os_SUITE.erl18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/kernel/test/os_SUITE.erl b/lib/kernel/test/os_SUITE.erl
index b08b12c978..ae3410d13f 100644
--- a/lib/kernel/test/os_SUITE.erl
+++ b/lib/kernel/test/os_SUITE.erl
@@ -117,9 +117,21 @@ space_in_name(Config) when is_list(Config) ->
?line ok = file:change_mode(Echo, 8#777), % Make it executable on Unix.
%% Run the echo program.
-
- ?line comp("", os:cmd("\"" ++ Echo ++ "\"")),
- ?line comp("a::b::c", os:cmd("\"" ++ Echo ++ "\" a b c")),
+ %% Quoting on windows depends on if the full path of the executable
+ %% contains special characters. Paths when running common_tests always
+ %% include @, why Windows would always fail if we do not double the
+ %% quotes (this is the behaviour of cmd.exe, not Erlang's idea).
+ Quote = case os:type() of
+ {win32,_} ->
+ case (Echo -- "&<>()@^|") =:= Echo of
+ true -> "\"";
+ false -> "\"\""
+ end;
+ _ ->
+ "\""
+ end,
+ ?line comp("", os:cmd(Quote ++ Echo ++ Quote)),
+ ?line comp("a::b::c", os:cmd(Quote ++ Echo ++ Quote ++ " a b c")),
?t:sleep(5),
?line [] = receive_all(),
ok.