catch exit codes from commands