[erlang-patches] trivial patch: be more informative when exiting due to EOF

Niclas Axelsson burbas@REDACTED
Tue Dec 14 10:09:59 CET 2010


On 12/12/2010 11:52 PM, Matthias Lang wrote:
> 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.
>
> ________________________________________________________________
> erlang-patches (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-patches-unsubscribe@REDACTED
>    
Thanks Matthias,
Will include your patch into 'pu'.

Regards,
Niclas Axelsson, Erlang/OTP


More information about the erlang-patches mailing list