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

Attached to Project: QCAD
Opened by Peter (hungerburg) - Friday, 03 February 2012, 14:01 GMT+1
Last edited by Andrew (andrew) - Friday, 03 February 2012, 18:20 GMT+1
Task Type Bug Report
Category QCAD (main)
Status Closed
Assigned To Andrew (andrew)
Operating System All
Severity Low
Priority Normal
Reported Version 3 RC3
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


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.

This task depends upon

Closed by  Andrew (andrew)
Friday, 03 February 2012, 18:20 GMT+1
Reason for closing:  Fixed
Additional comments about closing:  r20432
Comment by Andrew (andrew) - Friday, 03 February 2012, 14:09 GMT+1

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)?

Comment by Andrew (andrew) - Friday, 03 February 2012, 14:13 GMT+1

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).

Comment by Peter (hungerburg) - Friday, 03 February 2012, 17:20 GMT+1

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


Comment by Peter (hungerburg) - Friday, 03 February 2012, 17:34 GMT+1

The rhino javascript interpreter has a "quit()" command, that takes an integer argument. Maybe qt ecma has that too?

Comment by Andrew (andrew) - Friday, 03 February 2012, 18:19 GMT+1

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.