Starting an Erlang slave node in escript fails when using custom Erlang in Ubuntu 10.4

Posted by Adam Lindberg on Stack Overflow See other posts from Stack Overflow or by Adam Lindberg
Published on 2010-05-27T14:53:31Z Indexed on 2010/06/02 23:14 UTC
Read the original article Hit count: 611

Filed under:
|

I have the following escript:

#!/usr/bin/env escript
%%! -name [email protected]

main(_) ->
    NodeName = test,
    Host = '127.0.0.1',
    Args = "",

    {ok, _Node} = slave:start_link(Host, NodeName, Args),
    io:format("Node started successfully!").

When running it on Ubuntu 10.04 I get this:

$ ./start_slave
Node started successfully!
$

I want to install my own Erlang (latest version, debug compiled files for dialyzer etc) since the stock install of Erlang on Ubuntu lacks some features. I put my Erlang binaries inside ~/Applications/bin. Starting Erlang normally works, and starting slave nodes inside an Erlang shell works as well.

However, now my escript doesn't work. After about 60 seconds it returns an error:

$ ./start_slave                                   
escript: exception error: no match of right hand side value {error,timeout}

Even if I change the first line to the escript to use my erlang version, it still does not work:

#!/home/user/Applications/bin/escript

The slave node is started with a call to erlang:open_port/2 which seems to be using sh which in turn does not read my .bashrc file that sets my custom PATH environment variable. The timeout seems to occur when slave:start_link/3 waits for the slave node to respond, which it never does.

How can I roll my own installation of Erlang and start slave nodes inside escripts on Ubuntu 10.4?

© Stack Overflow or respective owner

Related posts about ubuntu

Related posts about erlang