QCAD - 2D CAD System.
Click here for a documentation of the DokuWiki formatting syntax that can be used in reports
Please search for existing tasks (also closed ones) before opening a new task.
Please make sure that you are using the latest Version of QCAD before posting a bug (menu Help - Check for Updates)
FS#483 - Return value of autostart applications
Opened by Peter (hungerburg) - Friday, 03 February 2012, 14:01 GMT+2
Last edited by Andrew (andrew) - Friday, 03 February 2012, 18:20 GMT+2
|
DetailsWhe qcad runs a script from the autostart command line argument, then, if this script ends with an error, the qcad main function should not return 0, but something different, because the return value of 0 is conventionally used to indicate successful operation.
I enter this as a bug, rather than a feature request, because this convention is so entrained (at least in *NIX land), that it breaks fundamental expecations on application behaviour. |
Friday, 03 February 2012, 18:20 GMT+2
Reason for closing: Fixed
Additional comments about closing: r20432
Please define in more detail the part "if this script ends with an error". Does this mean a script exception is hit or a logical error (e.g. the script cannot find a file or the user given command line arguments are wrong, etc)?
Also: Can the return value be defined by the script? If so, how?
TODO: Find out how other script interpreters handle that situation (e.g. Python).
Dear Andrew, by "end with an error" I think of eg. exceptions in the ECMA interpreter, that are not caught in the script, things that bring up the debugger or have qcad -no-gui print a stack trace. They happen eventually to the best of programmers and qcad already knows of them.
To let the script itself define a return value was a nice feature. But for a start, a script could always just "throw" something and the consumer can parse the language. The need of integer return values other than 0=OK, 1=fail should post a use case first, not?
Thank You
Peter
The rhino javascript interpreter has a "quit()" command, that takes an integer argument. Maybe qt ecma has that too?
Qt indeed has QCoreApplication.exit(integerExitCode); but that exit code does not seem to make it to the caller. Not sure why.
An exit code of 1 if there are uncaught exceptions is certainly possible.