command-line option "-quit" should set the processs Exit status
Reported by Francois Granade
Now that we have the (very useful) "-quit" option, it should set the exit status; it's standard on Unix(es) and even on Windows for programs to set the exit status (process return code) based on the success or failure of their execution: zero if success, something else if failed. it's extremely useful to be able to continue (or not) processing when running from another program).
There could be even some codes:
- 1 = language error
- 2 = program error (division by zero...)
- 3 = user error (call to error())
HOW TO REPRODUCE THE BUG:
-------------------------
[scilab@vmlinux32]$ bin/scilab -nw -e "error('some error')" -quit
Scilab master-1446135343 (Nov 2 2015, 10:39:45)
------------------------------------------------------------
This is alpha version: avoid using in production
but please report any problem at http://bugzilla.scilab.org.
Thank you!
------------------------------------------------------------
some error
[scilab@vmlinux32 SuperCC]$ echo $? # <--- should show != 0
0
[scilab@vmlinux32 SuperCC]$ bin/scilab -nw -e "disp(1/0)" -quit
Scilab master-1446135343 (Nov 2 2015, 10:39:45)
------------------------------------------------------------
This is alpha version: avoid using in production
but please report any problem at http://bugzilla.scilab.org.
Thank you!
------------------------------------------------------------
Division by zero...
[scilab@vmlinux32 SuperCC]$ echo $? # <--- should show != 0
0
[scilab@vmlinux32 SuperCC]$ /home/scilab/SuperCC/sci_compil/scilab-master-1446135343/bin/scilab -nw -e "disp('no error')" -quit
Scilab master-1446135343 (Nov 2 2015, 10:39:45)
------------------------------------------------------------
This is alpha version: avoid using in production
but please report any problem at http://bugzilla.scilab.org.
Thank you!
------------------------------------------------------------
no error
[scilab@vmlinux32 SuperCC]$ echo $? # correct:
0
OTHER INFORMATION:
------------------
Edited by Clément DAVID