Skip to content

Commit 4f18916

Browse files
gh-124703: Set return code to 1 when aborting process from pdb (#133013)
1 parent ee033d4 commit 4f18916

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Lib/pdb.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1834,7 +1834,7 @@ def do_quit(self, arg):
18341834
reply = 'y'
18351835
self.message('')
18361836
if reply == 'y' or reply == '':
1837-
sys.exit(0)
1837+
sys.exit(1)
18381838
elif reply.lower() == 'n':
18391839
return
18401840

Lib/test/test_pdb.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4453,7 +4453,7 @@ def test_quit(self):
44534453
y
44544454
"""
44554455

4456-
stdout, stderr = self._run_script(script, commands)
4456+
stdout, stderr = self._run_script(script, commands, expected_returncode=1)
44574457
self.assertIn("2", stdout)
44584458
self.assertIn("Quit anyway", stdout)
44594459
# Closing stdin will quit the debugger anyway so we need to confirm
@@ -4483,7 +4483,7 @@ def test_quit_after_interact(self):
44834483
y
44844484
"""
44854485

4486-
stdout, stderr = self._run_script(script, commands)
4486+
stdout, stderr = self._run_script(script, commands, expected_returncode=1)
44874487
# Normal exit should not print anything to stderr
44884488
self.assertEqual(stderr, "")
44894489
# The quit prompt should be printed exactly once
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Set return code to ``1`` when aborting process from :mod:`pdb`.

0 commit comments

Comments
 (0)