aboutsummaryrefslogtreecommitdiffstats
path: root/lib/os_mon/src/os_mon.erl
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2012-01-25 14:50:03 +0100
committerLukas Larsson <[email protected]>2012-01-25 14:50:03 +0100
commit8b129dda86fe28b943180153561423bbb7957582 (patch)
treecf8bbbaa38085e9c9d848b3e629b1e8d2b2e8624 /lib/os_mon/src/os_mon.erl
parent25a98803743f25f36377790edc4b6315639aade7 (diff)
parent373f3227400d2cabe9c7cf3170b1cad4f5c2488a (diff)
downloadotp-8b129dda86fe28b943180153561423bbb7957582.tar.gz
otp-8b129dda86fe28b943180153561423bbb7957582.tar.bz2
otp-8b129dda86fe28b943180153561423bbb7957582.zip
Merge branch 'lukas/os_mon/work_in_source_tree/OTP-9883' into maint
* lukas/os_mon/work_in_source_tree/OTP-9883: Look for port in priv/bin/arch/ as well as priv/bin/
Diffstat (limited to 'lib/os_mon/src/os_mon.erl')
-rw-r--r--lib/os_mon/src/os_mon.erl20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/os_mon/src/os_mon.erl b/lib/os_mon/src/os_mon.erl
index ef368571db..3098c38808 100644
--- a/lib/os_mon/src/os_mon.erl
+++ b/lib/os_mon/src/os_mon.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2012. 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
@@ -22,7 +22,7 @@
-behaviour(supervisor).
%% API
--export([call/2, call/3, get_env/2]).
+-export([call/2, call/3, get_env/2, open_port/2]).
%% Application callbacks
-export([start/2, stop/1]).
@@ -79,6 +79,22 @@ get_env(Service, Param) ->
Service:param_default(Param)
end.
+open_port(Name, Opts) ->
+ PrivDir = code:priv_dir(os_mon),
+ ReleasedPath = filename:join([PrivDir,"bin",Name]),
+ %% Check os_mon*/priv/bin/Name
+ case filelib:is_regular(ReleasedPath) of
+ true ->
+ erlang:open_port({spawn, ReleasedPath}, Opts);
+ false ->
+ %% Use os_mon*/priv/bin/Arch/Name
+ ArchPath =
+ filename:join(
+ [PrivDir,"bin",erlang:system_info(system_architecture),Name]),
+ erlang:open_port({spawn, ArchPath}, Opts)
+ end.
+
+
%%%-----------------------------------------------------------------
%%% Application callbacks
%%%-----------------------------------------------------------------