Check exit status of command