Incomplete processing of "-eval" with closed stdin

Sam Bobroff sam@REDACTED
Mon Dec 21 07:02:08 CET 2009


Hi,

I recently found that a small script of mine, run by passing Erlang code
as an argument to "erl -eval", was failing when run by cron. I could
easily reproduce the problem on the command line using this example:

$ erl  -eval 'io:fwrite("before\n"), receive after 1000 -> ok end,
io:fwrite("after\n"), init:stop().' < /dev/null
Eshell V5.7.4  (abort with ^G)
before
1> *** Terminating erlang (nonode@REDACTED)

It seems like init is terminating the VM as soon as it detects that
stdin is closed, which is almost immediately.

Obviously my script should have had "-noshell" and adding it fixes the
problem. However, it does seem like a bug that the code passed by -eval
is cut off while still executing.

Perhaps "-noshell" should be applied automatically when erl is started
with stdin already closed?

I'm using R13B03.

Sam.

--
Sam Bobroff | sam@REDACTED | M5 Networks
Why does my email have those funny headers? Because I use PGP to sign
my email (and you should too!): that's how you know it's really from me.
See: http://en.wikipedia.org/wiki/Pretty_Good_Privacy


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20091221/bd74caa1/attachment.bin>


More information about the erlang-bugs mailing list