Skip to content

Commit

Permalink
Merge pull request #51 from myd7349/fix-issue-50
Browse files Browse the repository at this point in the history
fix #50
  • Loading branch information
skywind3000 authored Jul 21, 2023
2 parents c8a9cd8 + 96d7042 commit b70a575
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion PyStand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,12 @@ const char *init_script =
" fp = os.fdopen(fd, 'w')\n"
" sys.stdout = fp\n"
" sys.stderr = fp\n"
" attached = True\n"
"except Exception as e:\n"
" fp = open(os.devnull, 'w')\n"
" sys.stdout = fp\n"
" sys.stderr = fp\n"
" attached = False\n"
#endif
"for n in ['.', 'lib', 'site-packages']:\n"
" test = os.path.abspath(os.path.join(PYSTAND_HOME, n))\n"
Expand All @@ -358,7 +360,9 @@ const char *init_script =
"try:\n"
" code = compile(text, PYSTAND_SCRIPT, 'exec')\n"
" exec(code, environ)\n"
"except:\n"
"except Exception:\n"
" if attached:\n"
" raise\n"
" import traceback, io\n"
" sio = io.StringIO()\n"
" traceback.print_exc(file = sio)\n"
Expand Down

0 comments on commit b70a575

Please sign in to comment.