aboutsummaryrefslogtreecommitdiffstats
path: root/lib/jinterface/test/jitu.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/jinterface/test/jitu.erl')
-rw-r--r--lib/jinterface/test/jitu.erl38
1 files changed, 20 insertions, 18 deletions
diff --git a/lib/jinterface/test/jitu.erl b/lib/jinterface/test/jitu.erl
index 571a2dc9c7..0e1af0ff22 100644
--- a/lib/jinterface/test/jitu.erl
+++ b/lib/jinterface/test/jitu.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -48,7 +48,7 @@ java(Java, Dir, Class, Args, Props) ->
-init_all(Config) when list(Config) ->
+init_all(Config) when is_list(Config) ->
case find_executable(["java"]) of
false -> {skip,"Found no Java VM"};
Path -> [{java,Path}|Config]
@@ -69,13 +69,13 @@ find_executable([E|T]) ->
Path -> Path
end.
-to_string([H|T]) when integer(H) ->
+to_string([H|T]) when is_integer(H) ->
integer_to_list(H)++" "++to_string(T);
-to_string([H|T]) when atom(H) ->
+to_string([H|T]) when is_atom(H) ->
atom_to_list(H)++" "++to_string(T);
-to_string([H|T]) when pid(H) ->
+to_string([H|T]) when is_pid(H) ->
pid_to_list(H)++" "++to_string(T);
-to_string([H|T]) when list(H) ->
+to_string([H|T]) when is_list(H) ->
lists:flatten(H)++" "++to_string(T);
to_string([]) -> [].
@@ -84,35 +84,37 @@ to_string([]) -> [].
% filename:join(Dir, File)).
classpath(Dir) ->
- PS =
+ {PS,Quote,EscSpace} =
case os:type() of
- {win32, _} -> ";";
- _ -> ":"
+ {win32, _} -> {";","\"",""};
+ _ -> {":","","\\"}
end,
es(Dir++PS++
filename:join([code:lib_dir(jinterface),"priv","OtpErlang.jar"])++PS++
case os:getenv("CLASSPATH") of
false -> "";
Classpath -> Classpath
- end).
+ end,
+ Quote,
+ EscSpace).
-es(L) ->
- lists:flatmap(fun($ ) ->
- "\\ ";
- (C) ->
- [C]
- end,lists:flatten(L)).
+es(L,Quote,EscSpace) ->
+ Quote++lists:flatmap(fun($ ) ->
+ EscSpace++" ";
+ (C) ->
+ [C]
+ end,lists:flatten(L)) ++ Quote.
cmd(Cmd) ->
PortOpts = [{line,80},eof,exit_status,stderr_to_stdout],
io:format("cmd: ~s~n", [Cmd]),
case catch open_port({spawn,Cmd}, PortOpts) of
- Port when port(Port) ->
+ Port when is_port(Port) ->
Result = cmd_loop(Port, []),
io:format("cmd res: ~w~n", [Result]),
case Result of
0 -> ok;
- ExitCode when integer(ExitCode) -> {error,ExitCode};
+ ExitCode when is_integer(ExitCode) -> {error,ExitCode};
Error -> Error
end;
{'EXIT',Reason} ->