summaryrefslogtreecommitdiff
path: root/server/user_session.py
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-09-16 16:10:59 +0200
committerTimotej Lazar <timotej.lazar@araneo.org>2015-09-16 16:10:59 +0200
commit251c5e2ba0e85103c55cf31026739b2e7e9d4b90 (patch)
treed01abacb559c69fdfe3ef205a683496533da8369 /server/user_session.py
parentb9f1c57fdd6097e776235c105c58c29f84399523 (diff)
Implement async. comm. with Python interpreter
Creating, destroying and communicationg with the interpreter subprocess is now handled by a thread attached to PythonSession. Interpreter is sandboxed using libseccomp.
Diffstat (limited to 'server/user_session.py')
-rw-r--r--server/user_session.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/server/user_session.py b/server/user_session.py
index 2cc629c..0d8535c 100644
--- a/server/user_session.py
+++ b/server/user_session.py
@@ -62,7 +62,8 @@ class UserSession(object):
def get_python(self):
with self._access_lock:
if self.python_session is None:
- self.python_session = python_session.PythonSession() # lazy init
+ self.python_session = python_session.PythonSession(
+ output_cb=lambda text: self.send({'event': 'terminal_output', 'text': text}))
return self.python_session
def get_problem_data(self, language, problem_group, problem):