Use exit codes
Merge pull request #1661 from aah/use-exit-codes

Exit with status of 1 on error