diff options
author | Lukas Larsson <lukas@erlang-solutions.com> | 2014-03-23 22:51:19 +0100 |
---|---|---|
committer | Lukas Larsson <lukas@erlang-solutions.com> | 2014-03-26 15:18:59 +0100 |
commit | 8af4baec6e25febcc4457c85bd9079b672990c9c (patch) | |
tree | abf41b583efa55b481f11262deaa2c709d00904e /lib | |
parent | 09c1cbf863864a5740f7c13c136b1164aac70469 (diff) | |
download | erlang-8af4baec6e25febcc4457c85bd9079b672990c9c.tar.gz |
ose: Prepare slave for running on OSE
This change relies on the assumption that all arguments before the last --
to the parent beam should be left as they are.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kernel/src/os.erl | 2 | ||||
-rw-r--r-- | lib/stdlib/src/slave.erl | 23 |
2 files changed, 23 insertions, 2 deletions
diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl index 9ffa9adeab..6303ca29fb 100644 --- a/lib/kernel/src/os.erl +++ b/lib/kernel/src/os.erl @@ -67,7 +67,7 @@ unsetenv(_) -> %%% End of BIFs -spec type() -> {Osfamily, Osname} when - Osfamily :: unix | win32, + Osfamily :: unix | win32 | ose, Osname :: atom(). type() -> diff --git a/lib/stdlib/src/slave.erl b/lib/stdlib/src/slave.erl index 3e647635bc..1898dc8aba 100644 --- a/lib/stdlib/src/slave.erl +++ b/lib/stdlib/src/slave.erl @@ -290,7 +290,10 @@ register_unique_name(Number) -> %% no need to use rsh. mk_cmd(Host, Name, Args, Waiter, Prog0) -> - Prog = quote_progname(Prog0), + Prog = case os:type() of + {ose,_} -> mk_ose_prog(Prog0); + _ -> quote_progname(Prog0) + end, BasicCmd = lists:concat([Prog, " -detached -noinput -master ", node(), " ", long_or_short(), Name, "@", Host, @@ -310,6 +313,24 @@ mk_cmd(Host, Name, Args, Waiter, Prog0) -> end end. +%% On OSE we have to pass the beam arguments directory to the slave +%% process. To find out what arguments that should be passed on we +%% make an assumption. All arguments after the last "--" should be +%% skipped. So given these arguments: +%% -Muycs256 -A 1 -- -root /mst/ -progname beam.debug.smp -- -home /mst/ -- -kernel inetrc '"/mst/inetrc.conf"' -- -name test@localhost +%% we send +%% -Muycs256 -A 1 -- -root /mst/ -progname beam.debug.smp -- -home /mst/ -- -kernel inetrc '"/mst/inetrc.conf"' -- +%% to the slave with whatever other args that are added in mk_cmd. +mk_ose_prog(Prog) -> + SkipTail = fun("--",[]) -> + ["--"]; + (_,[]) -> + []; + (Arg,Args) -> + [Arg," "|Args] + end, + [Prog,tl(lists:foldr(SkipTail,[],erlang:system_info(emu_args)))]. + %% 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. |