[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is fork() broken in octave 5.1 ?
From: |
Kay Nick |
Subject: |
Re: Is fork() broken in octave 5.1 ? |
Date: |
Thu, 26 Sep 2019 19:27:55 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 |
ftest.m :
function ret=ftest()
[pid, msg]=fork();
if (pid > 0)
pid
msg
endif
ret=0;
forktest.m
A=23;
ftest()
gives me
>> forktest
pid = 3345
msg =
ans = ans0
= 0
>>
which is pretty much what I'd expect. Maybe we should mention this in
the documentation or in the error message... (only allowed in a function)
> The error message says "command line", but includes scripts as well.
> This error was added intentionally, so it looks to me like the function
> is working correctly.
Nevertheless I find this behavior not intuitive... What is the reason
for preventing fork() from being used in a simple script?
Marcin
On 26.09.19 19:04, Mike Miller wrote:
> On Thu, Sep 26, 2019 at 17:37:13 +0200, Kay Nick wrote:
>> ...or am I getting something wrong here?
>>
>> Dear folks,
>>
>> this simple script (forktest.m)
>>
>> A=23;
>> [pid, msg]=fork();
>> if (pid > 0)
>> pid
>> msg
>> endif
>>
>> gives me the error
>>
>>>> forktest
>> error: fork: cannot be called from command line
>> error: called from
>> forktest at line 2 column 11
>>
>> Tested it on Arch Linux as well as Manjaro (64 bit) with all recent
>> updates installed. Any idea?
> The error message says "command line", but includes scripts as well.
> This error was added intentionally, so it looks to me like the function
> is working correctly. Have you tried turning forktest.m into a function
> file?
>
- Switch to std::atomic?, Rik, 2019/09/13
- Re: Switch to std::atomic?, John W. Eaton, 2019/09/25
- Re: Switch to std::atomic?, John W. Eaton, 2019/09/25
- Is fork() broken in octave 5.1 ?, Kay Nick, 2019/09/26
- Re: Is fork() broken in octave 5.1 ?, Mike Miller, 2019/09/26
- Re: Is fork() broken in octave 5.1 ?,
Kay Nick <=
- Re: Is fork() broken in octave 5.1 ?, Mike Miller, 2019/09/26
- Re: Is fork() broken in octave 5.1 ?, John W. Eaton, 2019/09/26
- Re: Is fork() broken in octave 5.1 ?, Dr. K. nick, 2019/09/27
- Re: Switch to std::atomic?, John W. Eaton, 2019/09/26
- Re: Switch to std::atomic?, Dmitri A. Sergatskov, 2019/09/26
- Re: Switch to std::atomic?, John W. Eaton, 2019/09/27
- Re: Switch to std::atomic?, Rik, 2019/09/26
- Re: Switch to std::atomic?, John W. Eaton, 2019/09/26
- Re: Switch to std::atomic?, Rik, 2019/09/26
- Re: Switch to std::atomic?, John W. Eaton, 2019/09/27