trivial patch: be more informative when exiting due to EOF

Matthias Lang matthias@REDACTED
Sun Dec 12 23:52:22 CET 2010


Hi,

git fetch git://github.com/matthiasl/otp.git better-error-message-on-shell-input-eof

Be more helpful when the shell encounters EOF

The shell terminates the VM when EOF is hit on stdin. Give the
user a better clue about what's happened and how to avoid the
problem. Useful for people who run Erlang from 'cron' or '.forward'

(If you do this:

  >erl -s some_module go -s init stop < /dev/null

then some_module:go() will get called and killed a bit later. The old
error message didn't give much of a clue as to what was going on.)

Matt

----------------------------------------------------------------------

diff --git a/lib/stdlib/src/shell.erl b/lib/stdlib/src/shell.erl
index ebb221c..c156cb7 100644
--- a/lib/stdlib/src/shell.erl
+++ b/lib/stdlib/src/shell.erl
@@ -280,10 +280,14 @@ server_loop(N0, Eval_0, Bs00, RT, Ds00, History0, Results0) ->
                             [N]),
            server_loop(N0, Eval0, Bs0, RT, Ds0, History0, Results0);
        {eof,_EndLine} ->
-            fwrite_severity(fatal, <<"Terminating erlang (~w)">>, [node()]),
+            fwrite_severity(fatal, <<"EOF on stdin (did you mean to use "
+                                   "-noinput?). Terminating erlang (~w)">>, 
+                           [node()]),
            halt();
        eof ->
-            fwrite_severity(fatal, <<"Terminating erlang (~w)">>, [node()]),
+            fwrite_severity(fatal, <<"EOF on stdin (did you mean to use "
+                                   "-noinput?). Terminating erlang (~w)">>, 
+                           [node()]),
            halt()
     end.


More information about the erlang-patches mailing list