summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_control_main.erl2
-rw-r--r--src/rabbit_disk_monitor.erl3
-rw-r--r--src/rabbit_misc.erl21
3 files changed, 14 insertions, 12 deletions
diff --git a/src/rabbit_control_main.erl b/src/rabbit_control_main.erl
index 4be77f828c..c57c9f4a8e 100644
--- a/src/rabbit_control_main.erl
+++ b/src/rabbit_control_main.erl
@@ -603,7 +603,7 @@ process_up(Pid) ->
end},
{win32, fun () ->
Cmd = "tasklist /nh /fi \"pid eq " ++ Pid ++ "\" ",
- Res = os:cmd(rabbit_misc:win32_cmd(Cmd ++ "2>&1")),
+ Res = rabbit_misc:os_cmd(Cmd ++ "2>&1"),
case re:run(Res, "erl\\.exe", [{capture, none}]) of
match -> true;
_ -> false
diff --git a/src/rabbit_disk_monitor.erl b/src/rabbit_disk_monitor.erl
index 227bbceec9..9b7bafd50e 100644
--- a/src/rabbit_disk_monitor.erl
+++ b/src/rabbit_disk_monitor.erl
@@ -168,8 +168,7 @@ get_disk_free(Dir, {unix, Sun})
get_disk_free(Dir, {unix, _}) ->
parse_free_unix(rabbit_misc:os_cmd("/bin/df -kP " ++ Dir));
get_disk_free(Dir, {win32, _}) ->
- Cmd = "dir /-C /W \"" ++ Dir ++ [$"],
- parse_free_win32(os:cmd(rabbit_misc:win32_cmd(Cmd)));
+ parse_free_win32(rabbit_misc:os_cmd("dir /-C /W \"" ++ Dir ++ [$"]));
get_disk_free(_, Platform) ->
{unknown, Platform}.
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index 672d3b409f..ce7d73c7bc 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -60,7 +60,6 @@
-export([append_rpc_all_nodes/4]).
-export([multi_call/2]).
-export([os_cmd/1]).
--export([win32_cmd/1]).
-export([gb_sets_difference/2]).
-export([version/0, which_applications/0]).
-export([sequence_error/1]).
@@ -231,7 +230,6 @@
-spec(multi_call/2 ::
([pid()], any()) -> {[{pid(), any()}], [{pid(), any()}]}).
-spec(os_cmd/1 :: (string()) -> string()).
--spec(win32_cmd/1 :: (string()) -> string()).
-spec(gb_sets_difference/2 :: (gb_set(), gb_set()) -> gb_set()).
-spec(version/0 :: () -> string()).
-spec(which_applications/0 :: () -> [{atom(), string(), string()}]).
@@ -975,15 +973,20 @@ receive_multi_call([{Mref, Pid} | MonitorPids], Good, Bad) ->
end.
os_cmd(Command) ->
- Exec = hd(string:tokens(Command, " ")),
- case os:find_executable(Exec) of
- false -> throw({command_not_found, Exec});
- _ -> os:cmd(Command)
+ case os:type() of
+ {win32, _} ->
+ %% Clink workaround; see
+ %% http://code.google.com/p/clink/issues/detail?id=141
+ os:cmd(" " + Command);
+ _ ->
+ %% Don't just return "/bin/sh: <cmd>: not found" if not found
+ Exec = hd(string:tokens(Command, " ")),
+ case os:find_executable(Exec) of
+ false -> throw({command_not_found, Exec});
+ _ -> os:cmd(Command)
+ end
end.
-%% Clink workaround: http://code.google.com/p/clink/issues/detail?id=141
-win32_cmd(Command) -> " " ++ Command.
-
gb_sets_difference(S1, S2) ->
gb_sets:fold(fun gb_sets:delete_any/2, S1, S2).