[erlang-bugs] Wrong EXIT status when shell startup fails

Thomas Lange <>
Thu Dec 8 15:14:16 CET 2011

There is a bug that occurs when Erlang is started with shell activated
but shell cannot be launched. When this happens, erlang terminates
with exit status 0, which is incorrect behavior.

A typical example is when Erlang is started via a cron job.

How to trigger bug:

* Put both attached files in /tmp
* update crontest with path to your otp release
* compile crontest.erl
* run /tmp/crontest via cron
* cronjob should fail

Example on system running debian squeeze and otp git HEAD:
k4:/tmp$ chmod +x crontest
k4:/tmp$ /u1/otp/bin/erlc crontest.erl
k4:/tmp$ ls -l crontest*
-rwxr-xr-x 1 tle tle 681 Dec  8 14:42 crontest
-rw-r--r-- 1 tle tle 536 Dec  8 14:45 crontest.beam
-rw-r--r-- 1 tle tle  83 Dec  8 14:42 crontest.erl
k4:/tmp$ ./crontest
Erlang R15B (erts-5.9) [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.9  (abort with ^G)
1> Erlang exit status 100. Normal result when everything is started ok.

k4:/tmp$ crontab -e
crontab: installing new crontab
k4:/tmp$ crontab -l
# m h  dom mon dow   command
47 14 * * * /tmp/crontest

Dec  8 14:47:02 k4 /USR/SBIN/CRON[27923]: (CRON) error (grandchild #27924 failed with exit status 1)

Cron daemon error mail contains:
Eshell V5.9  (abort with ^G)
1> *** Terminating erlang ()
Erlang exit status 0. Should never happen!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: crontest.erl
Type: text/x-erlang
Size: 83 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20111208/6beb77d2/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: crontest
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20111208/6beb77d2/attachment.ksh>

More information about the erlang-bugs mailing list