Skip to content

Instantly share code, notes, and snippets.

@brweber2
Last active August 29, 2015 14:22
Show Gist options
  • Save brweber2/c8f8b48fd526a01c12a2 to your computer and use it in GitHub Desktop.
Save brweber2/c8f8b48fd526a01c12a2 to your computer and use it in GitHub Desktop.
# (arity 0)
root@deleteme:~/foo# bin/foo rpc Foo bar
RPC to 'foo@127.0.0.1' failed: {'EXIT',
{undef,
[{'Foo',bar,[],[]},
{rpc,'-handle_call_call/6-fun-0-',5,
[{file,"rpc.erl"},{line,205}]}]}}
root@deleteme:~/foo# bin/foo rpc Elixir.Foo bar
yeah!
:ok
# (arity 1) -- note the erlang terms and '.' at the end... we have to pass an array of the args, which in our case is an array
What about with arguments to Elixir.Foo main?
root@deleteme:~/foo# bin/foo rpc Elixir.Foo main "[1]"
escript: exception error: no match of right hand side value
{error,{0,erl_parse,["syntax error before: ",[]]}}
root@deleteme:~/foo# bin/foo rpc Elixir.Foo main "[[1,2,3]]."
Your arg is 1
Your arg is 2
Your arg is 3
[ok,ok,ok]
# Finally, the escript way that doesn't require bin/foo start
root@deleteme:~/foo# bin/foo escript lib/foo-0.0.1/ebin/Elixir.Foo.beam "fo" "bar" 1 2 3
Your arg is fo
Your arg is bar
Your arg is 1
Your arg is 2
Your arg is 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment