[erlang-questions] Bug in amd64 escript

Edwin Fine erlang-questions_efine@REDACTED
Wed Sep 24 19:42:03 CEST 2008


My guess is that the Erlang VM is exiting before the text you have written
to standard output has been flushed to the operating system, which will
cause the unflushed text to disappear. What you have to do is ensure that
the 'bobeer' process completes its output operations before Erlang exits. If
you look in the documentation about the -s flag to erl (in the init module
of the kernel application), you will see that it says that each process
called via -s completes before the next one is started:

The functions are executed sequentially in an initialization process, which
> then terminates normally and passes control to the user. This means that a
> -s call which does not return will block further processing; to avoid
> this, use some variant of spawn in such cases.
>

It also says that init:stop() smoothly takes down the processes, which
possibly includes flushing any unwritten buffers to the O/S (not sure of
this). erlang:halt() I think is much more brutal, but I stand to be
corrected. This is probably why calling -s init stop after -s bobeer bobeer
has the effect it has.


2008/9/24 G. Allen Morris III <gam3-erlang@REDACTED>

> I was writing a simple little script in erlang that outputs lots of
> text to standard out.  The problem is that the output is cut off.
>
> If I pipe the output through 'more' then all the output is seen.
>
> I get simular output if I run the program with
>
> erl -noshell -pa `pwd` \
>    -s bobeer bobeer  -s erlang halt
>
> If I use
>
> erl -noshell -pa `pwd` \
>    -s bobeer bobeer  -s init stop
>
> then it works.
>
> Having init:stop() at the end of the script does not help.
>
> This is on debian with this version
>
>  Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:3]
>  [async-threads:0] [kernel-poll:false]
>
> This problem does not seem to be on my 32 bit computer
>
>  Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0]
>  [kernel-poll:false]
>
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iGcEARECACcFAkjaQw4gGmh0dHA6Ly93d3cuZ2FtMy5uZXQvcG9saWN5Lmh0bWwA
> CgkQVVDRYykdW3ziZACePxtJ4odALLQhe9cnf56Jdga6AGIAn3TLJhxBcZhPAsQi
> TOrHX1gUOlOY
> =vfB+
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080924/b7a4d936/attachment.htm>


More information about the erlang-questions mailing list