Minimal embedded Erland system

Joergen Froejk Kjaersgaard jfk@REDACTED
Wed Sep 22 21:39:14 CEST 1999


I have tried to make a minimal embedded Erlang system to use as a
template. However, when i start the system - even in embedded mode - I
get an Erlang shell prompt.

The files involved are:

test.erl:
======
-module(test).
-behaviour(application).
-export([hello_sayer/0, start/2, stop/1]).

hello_sayer() ->
    io:put_chars("hello, world\n"),
    receive _ -> []
    end.

start(Type, Args) ->
    io:put_chars("Application started\n"),
    P = spawn(test, hello_sayer, []),
    {ok, P, P}.

stop(P) ->
    io:put_chars("Application has exited\n"),
    exit(P).

test.app:
=======
{application, test,
 [{description,  "A simple test application"},
  {vsn,          "1.0"},
  {id,           "Test"},
  {modules,      [{test,"1.0"}]},
  {maxP,         infinity},
  {maxT,         infinity},
  {registered,   []},
  {applications, [kernel, stdlib]},
  {included_applications, []},
  {env,          []},
  {mod,          {test, []}},
  {start_phases, []}]}.

test.rel:
=====
{release, {"test","1.0"}, {erts, "4.4"},
 [{test, "1.0", permanent},
 {kernel, "2.1.4", permanent},
 {stdlib, "1.5.2", permanent}]}.


I make a boot script using systools:make_script() and start the system
using "erl -boot test -mode embedded -pz /home/jfk/test/ebin". The
system writes "Application started" and "hello, world" as expected but
then a beam shell prompt appears! I expected the system to wait forever
(because nothing is ever sent to the started process). What am I doing
wrong? How can I make a minimal system which can be started from a Unix
shell, write something to standard output and then exit to the Unix
shell?

--
Jørgen Frøjk Kjærsgaard, Systemkonsulent (Systems Consultant)
Informaticon ApS * Nørrevænget 143 * DK-8310 Tranbjerg J
Tlf: 8672 0093 * E-mail: jfk@REDACTED * http://www.informaticon.dk


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/19990922/b5aa658a/attachment.htm>


More information about the erlang-questions mailing list