| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 852825a commit b484236
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1874,10 +1874,17 @@ def main_curses(scr, args, config, interactive=True, locals_=None, | |||
| 1874 | 1874 | sys.stderr = FakeStream(clirepl) | |
| 1875 | 1875 | ||
| 1876 | 1876 | if args: | |
| 1877 | - bpython.args.exec_code(interpreter, args) | ||
| 1877 | + exit_value = 0 | ||
| 1878 | + try: | ||
| 1879 | + bpython.args.exec_code(interpreter, args) | ||
| 1880 | + except SystemExit, e: | ||
| 1881 | + # The documentation of code.InteractiveInterpreter.runcode claims | ||
| 1882 | + # that it reraises SystemExit. However, I can't manage to trigger | ||
| 1883 | + # that. To be one the safe side let's catch SystemExit here anyway. | ||
| 1884 | + exit_value = e.args | ||
| 1878 | 1885 | if not interactive: | |
| 1879 | 1886 | curses.raw(False) | |
| 1880 | - return clirepl.getstdout() | ||
| 1887 | + return (exit_value, clirepl.getstdout()) | ||
| 1881 | 1888 | else: | |
| 1882 | 1889 | sys.path.insert(0, '') | |
| 1883 | 1890 | clirepl.startup() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments