aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2011-12-08 17:18:19 +0100
committerPatrik Nyblom <[email protected]>2011-12-08 17:18:19 +0100
commit1869f2de2f499398665a99619a86f99f4eb9779a (patch)
tree2c900b0339cc9ceeb3d796e8ccb014c7c0568c79 /lib/kernel/test
parent6e3ab5e75e35c9166683b65b9443fa7ce3ac86ae (diff)
parent62369833ca4e26dd12a8a7795dd1a69f39d7c57d (diff)
downloadotp-1869f2de2f499398665a99619a86f99f4eb9779a.tar.gz
otp-1869f2de2f499398665a99619a86f99f4eb9779a.tar.bz2
otp-1869f2de2f499398665a99619a86f99f4eb9779a.zip
Merge branch 'pan/space_in_filename/OTP-9598'
* pan/space_in_filename/OTP-9598: Teach os_SUITE:space_in_name to quote correctly on Windows
Diffstat (limited to 'lib/kernel/test')
-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.