bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exit status from APL; and expected exit code with CORE_COUNT_WANTED=


From: Dr . Jürgen Sauermann
Subject: Re: Exit status from APL; and expected exit code with CORE_COUNT_WANTED=n vs. without
Date: Mon, 29 Nov 2021 20:18:17 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

Hi Russ,

1) calling exit() via ⎕FIO is not a good idea (and therefore not supported). Before an apl session
exits via )OFF it performs a number of important clean-up actions such as saving the history,
which exit() wouldn't do.

I have added an optional argument to command )OFF by means of  which you can specify the desired
exit code (the default exit code is 0). It is also allowed to )OFF programmatically with ⍎')OFF'.
SVN 1499.

2) I suppose that the default ./configure runs apl in a single thread which exits silently,
while CORE_COUNT_WANTED=4 creates a pool of threads from which the "Killed" message
comes when the master thread is being killed. Its not intentional but just happens.

I suppose $? is not reliable in a multi-threaded environment due to a race condition
between processes terminated at the same time and the exit codes may differ.

Best Regards,
Jürgen



On 11/29/21 1:21 AM, Russtopia wrote:
Hi, while investigating using GNU APL for scripting (--script), I have two questions:

1) Is there a way to specify an exit code in APL scripts? I didn't see any ⎕FIO or system call interface to invoke the host OS exit() with a code other than the implied 0 code in GNU APL's source function Code_OFF() function;

2) Is it intentional that there is a behavioural difference with GNU APL when configured with the CORE_COUNT_WANTED= environment variable set explicitly:

$ make clean
$ CORE_COUNT_WANTED=4 ./configure && make -j
...
$ src/apl -q
)OFF
Killed
$ echo $?
137

versus

$ make clean
$ ./configure && make -j
...
$ src/apl -q
)OFF
$ echo $?
0

Also running without the -q flag, )OFF prints the 'Goodbye' and 'Session Duration' information upon exit when CORE_COUNT_WANTED= is not set, and just 'Killed' when it is.

I don't know if this is symptomatic of anything but thought it might be worth mentioning, in case this is a bug?

-Russ



reply via email to

[Prev in Thread] Current Thread [Next in Thread]