diff options
author | Dan Gudmundsson <[email protected]> | 2017-04-21 14:49:18 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2017-04-24 14:14:39 +0200 |
commit | fab97e165a79db10b7b560be5aefc7489982bced (patch) | |
tree | 45aa6c78ee53704e1c43edf9fe27f3fc2eb7ee8c /erts/etc/common/erlexec.c | |
parent | 739bca3fc267c55d84c8f5c193d16c0b2a7eee13 (diff) | |
download | otp-fab97e165a79db10b7b560be5aefc7489982bced.tar.gz otp-fab97e165a79db10b7b560be5aefc7489982bced.tar.bz2 otp-fab97e165a79db10b7b560be5aefc7489982bced.zip |
Rename argv[0] from beam to invoking program name
Allows ps and htop to display the invoking program/script name
instead of beam[.smp].
Diffstat (limited to 'erts/etc/common/erlexec.c')
-rw-r--r-- | erts/etc/common/erlexec.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/erts/etc/common/erlexec.c b/erts/etc/common/erlexec.c index ee59759940..a1c6bb223b 100644 --- a/erts/etc/common/erlexec.c +++ b/erts/etc/common/erlexec.c @@ -583,8 +583,12 @@ int main(int argc, char **argv) erts_snprintf(tmpStr, sizeof(tmpStr), "%s" DIRSEP "%s" BINARY_EXT, bindir, emu); emu = strsave(tmpStr); - add_Eargs(emu); /* Will be argv[0] -- necessary! */ - + s = get_env("ESCRIPT_NAME"); + if(s) { + add_Eargs(s); /* argv[0] = scriptname*/ + } else { + add_Eargs(progname); /* argv[0] = erl or cerl */ + } /* * Add the bindir to the path (unless it is there already). */ |