Skip to content

Instantly share code, notes, and snippets.

@joedevivo
Last active December 16, 2015 06:09
Show Gist options
  • 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 [email protected] -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 [email protected] -hidden -remsh [email protected] -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,<<"([email protected])1> ">>}}
ok
3> port_command(P, "node().\n").
true
4> flush().
Shell got {#Port<0.517>,{data,<<"'[email protected]'\n">>}}
Shell got {#Port<0.517>,{data,<<"([email protected])2> ">>}}
ok
5> q().
ok
# 2, run the same command we ran with open_port from the command line
➜ ~ erl -name [email protected] -hidden -remsh [email protected] -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)
([email protected])1> node().
'[email protected]'
([email protected])2> q().
ok
([email protected])3>
User switch command
--> q
THE NODE NAMES ARE DIFFERENT!!!!!
@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