Move taking a reference to sys.stdout above fail() in modules/eval_python.py

This commit is contained in:
jesopo 2018-10-24 13:54:03 +01:00
parent 46179d2f38
commit f89b96f373

View file

@ -4,6 +4,7 @@ from src import ModuleManager, utils
EVAL_TEMPLATE = """
import io, json, sys
old_stdout = sys.stdout
def fail(s):
old_stdout.write(json.dumps({"success": False, "out": str(e)}))
sys.exit()
@ -13,7 +14,6 @@ try:
except SyntaxError as e:
fail(str(e))
old_stdout = sys.stdout
stdout = io.StringIO()
sys.stdout = stdout