| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -175,7 +175,12 @@ def main(): | |||
| 175 | 175 | '__package__': None, | |
| 176 | 176 | '__cached__': None, | |
| 177 | 177 | } | |
| 178 | - runctx(code, globs, None, options.outfile, options.sort) | ||
| 178 | + try: | ||
| 179 | + runctx(code, globs, None, options.outfile, options.sort) | ||
| 180 | + except BrokenPipeError as exc: | ||
| 181 | + # Prevent "Exception ignored" during interpreter shutdown. | ||
| 182 | + sys.stdout = None | ||
| 183 | + sys.exit(exc.errno) | ||
| 179 | 184 | else: | |
| 180 | 185 | parser.print_usage() | |
| 181 | 186 | return parser | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -595,7 +595,12 @@ def main(): | |||
| 595 | 595 | '__package__': None, | |
| 596 | 596 | '__cached__': None, | |
| 597 | 597 | } | |
| 598 | - runctx(code, globs, None, options.outfile, options.sort) | ||
| 598 | + try: | ||
| 599 | + runctx(code, globs, None, options.outfile, options.sort) | ||
| 600 | + except BrokenPipeError as exc: | ||
| 601 | + # Prevent "Exception ignored" during interpreter shutdown. | ||
| 602 | + sys.stdout = None | ||
| 603 | + sys.exit(exc.errno) | ||
| 599 | 604 | else: | |
| 600 | 605 | parser.print_usage() | |
| 601 | 606 | return parser | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + Fix CLI of :mod:`cProfile` and :mod:`profile` to catch | ||
| 2 | + :exc:`BrokenPipeError`. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments