summaryrefslogtreecommitdiffstats
path: root/Lib/profile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/profile.py')
-rwxr-xr-xLib/profile.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/profile.py b/Lib/profile.py
index 5cb017ed..d8599fb 100755
--- a/Lib/profile.py
+++ b/Lib/profile.py
@@ -595,7 +595,12 @@ def main():
'__package__': None,
'__cached__': None,
}
- runctx(code, globs, None, options.outfile, options.sort)
+ try:
+ runctx(code, globs, None, options.outfile, options.sort)
+ except BrokenPipeError as exc:
+ # Prevent "Exception ignored" during interpreter shutdown.
+ sys.stdout = None
+ sys.exit(exc.errno)
else:
parser.print_usage()
return parser