Check command output before exit status