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

Balint Reczey Balint.Reczey@REDACTED
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('axd301@REDACTED',erlang,apply,[fun() -> os:cmd("ls")
end,[]])
.

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

(axd-configure-13971@REDACTED)14> c(rem_fun).
{ok,rem_fun}               
(node1@REDACTED)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:


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


I tested it on R11B7.

Regards,
Balint





More information about the erlang-bugs mailing list