Checking command's exit code and exiting when non-zero