- Status Closed
- Percent Complete
- Task Type Bug Report
- Category QCAD (main)
-
Assigned To
Andrew - Operating System All
- Severity Low
- Priority Very Low
- Reported Version 3 RC3
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
Attached to Project: QCAD Bugtracker
Opened by Peter - 03.02.2012
Last edited by Andrew - 03.02.2012
Opened by Peter - 03.02.2012
Last edited by Andrew - 03.02.2012
FS#483 - Return value of autostart applications
Whe 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.
Closed by Andrew
03.02.2012 17:20
Reason for closing: Fixed
Additional comments about closing:
03.02.2012 17:20
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.