2012/11/8 hutou <hutou@numericable.fr>
I am writing a bash script to backup my data and want to secure it, but I
have a problem with the gramps exit code !
If I feed gramps with an *inexisting* database to backup, then an error
message is printed, but the return code says everything it's Ok !

Hmm, some of this was changed because Gramps was throwing an exception with return code 1, instead of just exiting.

I think the offending code for you is in cli/arghandler.py
If you search for sys.exit, you see there    sys.exit(0) and not what you would want, sys.exit(1)

Change the 0 to 1, save, and try again.
However, it might be better to raise an exception instead, and then in cli/grampscli.py write a try block around line 326...

Also, in the file gramps.py, at the end, you see: if errors ...
It might be optimal to also there do  a sys.exit(1) instead of just finishing the script.

If you make a patch, to upload it to a bug ticket on the bug tracker

Note that next version of Gramps will be quite different, you will need to retest bash scripts.


See below :

View this message in context: http://gramps.1791082.n4.nabble.com/Gramps-exit-code-tp4657313.html
Sent from the GRAMPS - User mailing list archive at Nabble.com.

Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
Gramps-users mailing list