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)OFFKilled
$ 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
