octave-maintainers
[Top][All Lists]
Advanced

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

return value of octave from command line in case of memory error


From: Luca Citi
Subject: return value of octave from command line in case of memory error
Date: Thu, 19 Jan 2012 17:48:20 -0500

Hello,
first of all thank you for developing octave which is a great tool.
My problem...
I have noticed that when running non-interactive, octave returns 0
even when it aborts due to insufficient memory (see below). As the return
value is 1 if there is a different type of error (e.g., undefined function
name), I think it should return non-zero even when the reason for the error is
an unsuccessful allocation. To fix this issue it is sufficient to add "
error_state = 2;" around line 411 (inside the catch bad_alloc) and line 479 of
octave.cc (version 3.2.4) .
This would help people using octave from a bash script to understand
whether the operation was completed successfully or not.
Thanks,
Luca


###
octave --eval "a=zeros(1e9);" ; echo $?
error: memory exhausted or requested size too large for range of Octave's index
0

octave --eval "a=ZZZzeros(2);" ; echo $?
error: `ZZZzeros' undefined near line 0 column 3
1

octave --eval "a=zeros(2);" ; echo $?
0
###


reply via email to

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