[erlang-questions] gen_server:cast from escript

YuanZhiqian <>
Tue Mar 8 07:47:11 CET 2016


Hi guys,
  I was trying to call gen_server:cast from a escript file, everything that used to work well in erl shell won't work in escript, I have no idea what made the difference, here is the code, could anyone help me to find a clue? 


#!/usr/bin/env escript
%%! -name  -setcookie budget_keeper
main(Argv) ->    {Node, File} = case Argv of                       [] ->                           {'', "cache"};                       [F] ->                           {'', F};                       [N, F] ->                           {N, F}                   end,    io:format("~p ~p ~p ~p~n", [node(), erlang:get_cookie(), Node, File]),    gen_server:cast({bk_main, Node}, {dump_data, File}).


As shown above, the target process is called "bk_main" which is on the node '', I have run the same code in erl shell, and bk_main can get the notice, but nothing happened when I ran the same code in this script.
Best regardsZhiqian 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160308/1a9e6b1f/attachment.html>


More information about the erlang-questions mailing list