I just spent 20 minutes banging my head over my code before it occured to me that gksu was to blame. And indeed:
$ gksu false; echo $? 0 This is wrong. -- Doesn't return correct system exit code https://launchpad.net/bugs/51633 -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs