aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
authorRichard Carlsson <[email protected]>2018-04-17 14:48:45 +0200
committerRichard Carlsson <[email protected]>2018-05-04 10:22:36 +0200
commitac193e9fa75d1d6ef1d24b077fcc31934842ccfb (patch)
tree2d8cc8baf4cedb683d0f4c1d80f4abe1496dc8be /lib/stdlib
parent3d44429177a7dbdac5662433cfc55f5b5113a959 (diff)
downloadotp-ac193e9fa75d1d6ef1d24b077fcc31934842ccfb.tar.gz
otp-ac193e9fa75d1d6ef1d24b077fcc31934842ccfb.tar.bz2
otp-ac193e9fa75d1d6ef1d24b077fcc31934842ccfb.zip
Eliminate call to lib:progname/1 in slave.erl
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/src/slave.erl14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/stdlib/src/slave.erl b/lib/stdlib/src/slave.erl
index b3f3206d67..37c1f6bfd9 100644
--- a/lib/stdlib/src/slave.erl
+++ b/lib/stdlib/src/slave.erl
@@ -187,7 +187,7 @@ start_link(Host, Name, Args) ->
start(Host, Name, Args, self()).
start(Host0, Name, Args, LinkTo) ->
- Prog = lib:progname(),
+ Prog = progname(),
start(Host0, Name, Args, LinkTo, Prog).
start(Host0, Name, Args, LinkTo, Prog) ->
@@ -296,7 +296,6 @@ mk_cmd(Host, Name, Args, Waiter, Prog0) ->
" -s slave slave_start ", node(),
" ", Waiter,
" ", Args]),
-
case after_char($@, atom_to_list(node())) of
Host ->
{ok, BasicCmd};
@@ -309,6 +308,15 @@ mk_cmd(Host, Name, Args, Waiter, Prog0) ->
end
end.
+%% Return the name of the script that starts (this) erlang
+progname() ->
+ case init:get_argument(progname) of
+ {ok, [[Prog]]} ->
+ Prog;
+ _Other ->
+ "no_prog_name"
+ end.
+
%% This is an attempt to distinguish between spaces in the program
%% path and spaces that separate arguments. The program is quoted to
%% allow spaces in the path.
@@ -317,7 +325,7 @@ mk_cmd(Host, Name, Args, Waiter, Prog0) ->
%% (through start/5) or if the -program switch to beam is used and
%% includes arguments (typically done by cerl in OTP test environment
%% in order to ensure that slave/peer nodes are started with the same
-%% emulator and flags as the test node. The return from lib:progname()
+%% emulator and flags as the test node. The result from progname()
%% could then typically be '/<full_path_to>/cerl -gcov').
quote_progname(Progname) ->
do_quote_progname(string:lexemes(to_list(Progname)," ")).