gh-80731: Avoid executing code in except block in cmd (GH-111740)

4 files changed