diff options
author | Lukas Larsson <[email protected]> | 2019-05-06 09:30:40 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2019-05-06 09:30:40 +0200 |
commit | 80ac43b4f3194fddf3f6c911cdf2d25125c56903 (patch) | |
tree | 6831cf43cd9dc090747fad8d78ad00494981798f /lib/kernel/src/user_drv.erl | |
parent | e4c8e5a7997205ccc371415ae5c1caf544b025c6 (diff) | |
parent | 6944df6e540d57f5ddf04e01d44d3aefd9c4720d (diff) | |
download | otp-80ac43b4f3194fddf3f6c911cdf2d25125c56903.tar.gz otp-80ac43b4f3194fddf3f6c911cdf2d25125c56903.tar.bz2 otp-80ac43b4f3194fddf3f6c911cdf2d25125c56903.zip |
Merge pull request #2219 from josevalim/jv-auto-host/OTP-15794
Add hostname to -remsh if none is given
Diffstat (limited to 'lib/kernel/src/user_drv.erl')
-rw-r--r-- | lib/kernel/src/user_drv.erl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/kernel/src/user_drv.erl b/lib/kernel/src/user_drv.erl index 08286dd476..69ff8e7971 100644 --- a/lib/kernel/src/user_drv.erl +++ b/lib/kernel/src/user_drv.erl @@ -120,7 +120,7 @@ server1(Iport, Oport, Shell) -> {Curr,Shell1} = case init:get_argument(remsh) of {ok,[[Node]]} -> - ANode = list_to_atom(Node), + ANode = list_to_atom(append_hostname(Node)), RShell = {ANode,shell,start,[]}, RGr = group:start(self(), RShell, rem_sh_opts(ANode)), {RGr,RShell}; @@ -139,6 +139,12 @@ server1(Iport, Oport, Shell) -> %% Enter the server loop. server_loop(Iport, Oport, Curr, User, Gr, {false, queue:new()}). +append_hostname(Node) -> + case string:find(Node, "@") of + nomatch -> Node ++ string:find(atom_to_list(node()), "@"); + _ -> Node + end. + rem_sh_opts(Node) -> [{expand_fun,fun(B)-> rpc:call(Node,edlin_expand,expand,[B]) end}]. |