set exitcode instead of calling sys.exit