|
From: | John W. Eaton |
Subject: | Re: Is fork() broken in octave 5.1 ? |
Date: | Thu, 26 Sep 2019 14:25:31 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
On 9/26/19 1:42 PM, Mike Miller wrote:
On Thu, Sep 26, 2019 at 19:27:55 +0200, Kay Nick wrote:Nevertheless I find this behavior not intuitive... What is the reason for preventing fork() from being used in a simple script?It is related to this (still open) bug report: https://savannah.gnu.org/bugs/?45625
Yes, the check was added to prevent simple calls to fork at the command line from creating two copies of Octave both competing for input from the terminal and possibly confusing users. Once this situation occurs, it can be difficult to recover from without killing the session.
The check that was added doesn't distinguish between the command line and a script evaluated from the command line. A script executes in the scope of the caller and the check was for execution at the top-level scope rather than checking the depth of the call stack.
Maybe we could change the condition so that it will allow fork if it is executed from a script but not directly from the command line.
jwe
[Prev in Thread] | Current Thread | [Next in Thread] |