[erlang-questions] slave:start_link/3 hangs if it can't start the slave

Roger Lipscombe roger@REDACTED
Thu Mar 6 11:25:06 CET 2014


If I start a slave node as follows:

Args = "-pa ebin -s spartacus -s init stop -config whoops",
{ok, Node} = slave:start_link(localhost, spartacus, Args).

...and the config file "whoops.config" doesn't exist, the call to
slave:start_link/3 hangs (it probably times out, but I got impatient).

If I run "erl -pa ebin -s spartacus -s init stop -config whoops", with
the missing config file, I get an error immediately.

So:
1. Can I detect that the slave failed to start without waiting for a timeout?
2. Alternatively, can I shorten the timeout period?
3. Should I just use "open_port({spawn, ..." instead?

OTOH, If I _do_ use open_port, how do I get the child erlang VM to
close when I kill the parent (which is actually an escript) using
Ctrl+C?

Regards,
Roger.



More information about the erlang-questions mailing list