Skip to content

Instantly share code, notes, and snippets.

@joedevivo
Last active December 16, 2015 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joedevivo/5389301 to your computer and use it in GitHub Desktop.
Save joedevivo/5389301 to your computer and use it in GitHub Desktop.
*Window A*
➜ ~ erl -name node@127.0.0.1 -setcookie joe
*Window B*
# 1, try starting erl with -remsh via open_port
➜ ~ erl
Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:4:4] [async-threads:0] [kernel-poll:false]
Eshell V5.9.3.1 (abort with ^G)
1> P = open_port({spawn, "erl -name local@127.0.0.1 -hidden -remsh node@127.0.0.1 -setcookie joe"},
1> [stream, use_stdio, exit_status, binary, stderr_to_stdout]).
#Port<0.517>
2> flush().
Shell got {#Port<0.517>,{data,<<"Eshell V5.9.3.1 (abort with ^G)\n">>}}
Shell got {#Port<0.517>,{data,<<"(local@127.0.0.1)1> ">>}}
ok
3> port_command(P, "node().\n").
true
4> flush().
Shell got {#Port<0.517>,{data,<<"'local@127.0.0.1'\n">>}}
Shell got {#Port<0.517>,{data,<<"(local@127.0.0.1)2> ">>}}
ok
5> q().
ok
# 2, run the same command we ran with open_port from the command line
➜ ~ erl -name local@127.0.0.1 -hidden -remsh node@127.0.0.1 -setcookie joe
Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:4:4] [async-threads:0] [kernel-poll:false]
Eshell V5.9.3.1 (abort with ^G)
(node@127.0.0.1)1> node().
'node@127.0.0.1'
(node@127.0.0.1)2> q().
ok
(node@127.0.0.1)3>
User switch command
--> q
THE NODE NAMES ARE DIFFERENT!!!!!
@joedevivo
Copy link
Author

I would have expected node@127.0.0.1 on lines #15, #20 and #21

@joedevivo
Copy link
Author

Why would I do this? to test basho/riak#254

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment