[erlang-bugs] calling anonymous function via rpc:call

Balint Reczey <>
Fri Feb 29 14:32:33 CET 2008


Hi,

I think the following module should call the anonymous function on the
remote node:

rem_func.erl:

-module(rem_fun).
-export([test/0]).

test() ->
        rpc:call('',erlang,apply,[fun() -> os:cmd("ls")
end,[]])
.

But when i compile and call the test function i get badrpc instead:

()14> c(rem_fun).
{ok,rem_fun}               
()15> rem_fun:test().
{badrpc,{'EXIT',{undef,[{#Fun<rem_fun.0.53346802>,[]},
                        {rpc,'-handle_call/3-fun-0-',5}]}}}


The same rpc:call works perfectly when i call it from erlang shell:


()16>         rpc:call('',erlang,apply,[fun() ->
os:cmd("ls") end,[]])
()16> .
"file1\nfile2\nfile3\n"
()17> 


I tested it on R11B7.

Regards,
Balint





More information about the erlang-bugs mailing list