[erlang-patches] run_erl: propagate exit status

Magnus Henoch magnus@REDACTED
Tue Feb 4 19:08:23 CET 2014


Not at the moment; I'm no longer using run_erl without the -daemon
option, so this is not a problem I need to solve anymore.  I guess it
should be dropped for now.

Regards,
Magnus

Sverker Eriksson <sverker.eriksson@REDACTED> writes:

> Magnus ! ping.
>
> Any interest in trying to get this two year old patch into OTP 17?
>
> The feature of propagating exit status seems reasonable and useful.
>
> /Sverker, Erlang/OTP
>
>
> On 11/29/2011 05:19 PM, Sverker Eriksson wrote:
>> Henrik:
>>
>> This  one should replace the current mh/run_erl-exit-status in pu:
>>
>> git fetch git://github.com/legoscia/otp.git run_erl_exit_status_simple
>>
>>
>> Magnus:
>>
>> I got two objections on the the other version using select timeout.
>>
>> 1. You don't check if it actually was a timeout from select() before
>> doing "want_to_exit = 1".
>> 2. No test that reproduces the more complicated case.
>>
>> /Sverker
>>
>>
>> Magnus Henoch wrote:
>>> Good catch, exit() is indeed not safe inside a signal handler, as it
>>> flushes stdio buffers etc.
>>>
>>> I committed a new version that uses a select timeout:
>>>
>>> git fetch git://github.com/legoscia/otp.git run_erl_exit_status
>>> https://github.com/legoscia/otp/commit/run_erl_exit_status
>>>
>>> But since I still haven't been able to reproduce the case that the
>>> alarm is supposed to handle, I also committed a simpler change
>>> that leaves the alarm signal as it used to be:
>>>
>>> git fetch git://github.com/legoscia/otp.git run_erl_exit_status_simple
>>> https://github.com/legoscia/otp/commit/run_erl_exit_status_simple
>>>
>>> That change still gives the correct result with all invocations I've
>>> tried.  It might be a safer bet...
>>>
>>> Regards,
>>> Magnus
>>>
>>> ----- Original Message -----
>>>> Patch review:
>>>>
>>>> Is it really right to call exit() from a signal handler like that.
>>>> Wouldn't it be safer to use the select() timeout instead of alarm().
>>>>
>>>> Sorry for the late review, code stop is tomorrow for R15B.
>>>>
>>>> /Sverker, Erlang/OTP
>>>>
>>>>
>>>> Magnus Henoch wrote:
>>>>> Hi all,
>>>>>
>>>>> Here is a patch that makes run_erl return the exit status of its
>>>>> child
>>>>> process.  (Probably only useful when using run_erl without -daemon,
>>>>> just for convenient logging.)
>>>>>
>>>>> I added a signal handler for SIGALRM, since that appeared to be one
>>>>> of
>>>>> the ways run_erl exits, but I haven't been able to trigger that in
>>>>> my
>>>>> testing (it always exits because it can't read from the child's
>>>>> pty).
>>>>> I would appreciate informed opinions about whether that part is
>>>>> necessary and correct.
>>>>>
>>>>> git fetch git://github.com/legoscia/otp.git run_erl_exit_status
>>>>> https://github.com/legoscia/otp/commit/29364cf9a6e1fcfd032503ff9888cffc4327b867 
>>>>>
>>>>>
>>>>> Regards,
>>>>> Magnus
>>>>> _______________________________________________
>>>>> erlang-patches mailing list
>>>>> erlang-patches@REDACTED
>>>>> http://erlang.org/mailman/listinfo/erlang-patches
>>>>>
>>>
>>
>>



More information about the erlang-patches mailing list