summaryrefslogtreecommitdiff
path: root/yaksh/stdio_evaluator.py
diff options
context:
space:
mode:
authoradityacp2017-04-27 18:37:19 +0530
committeradityacp2017-04-27 18:37:19 +0530
commit624e752684125aa525d9b3643cbd7c9b7ba61682 (patch)
tree726da35ba55acacfde255e31bdc2233600f75395 /yaksh/stdio_evaluator.py
parentb191455c7d9b0f6c3548da174a68c8ab8052abf0 (diff)
parent2694fd6dd4d37a1a6570792e234998feef21edca (diff)
downloadonline_test-624e752684125aa525d9b3643cbd7c9b7ba61682.tar.gz
online_test-624e752684125aa525d9b3643cbd7c9b7ba61682.tar.bz2
online_test-624e752684125aa525d9b3643cbd7c9b7ba61682.zip
Remove conflicts from views after rebase
Diffstat (limited to 'yaksh/stdio_evaluator.py')
-rw-r--r--yaksh/stdio_evaluator.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/yaksh/stdio_evaluator.py b/yaksh/stdio_evaluator.py
index fa78a68..554d4c5 100644
--- a/yaksh/stdio_evaluator.py
+++ b/yaksh/stdio_evaluator.py
@@ -1,7 +1,10 @@
from __future__ import unicode_literals
+import os
+import signal
# Local imports
from .base_evaluator import BaseEvaluator
+from .grader import TimeoutException
class StdIOEvaluator(BaseEvaluator):
@@ -9,9 +12,13 @@ class StdIOEvaluator(BaseEvaluator):
success = False
ip = expected_input.replace(",", " ")
encoded_input = '{0}\n'.format(ip).encode('utf-8')
- user_output_bytes, output_err_bytes = proc.communicate(encoded_input)
- user_output = user_output_bytes.decode('utf-8')
- output_err = output_err_bytes.decode('utf-8')
+ try:
+ user_output_bytes, output_err_bytes = proc.communicate(encoded_input)
+ user_output = user_output_bytes.decode('utf-8')
+ output_err = output_err_bytes.decode('utf-8')
+ except TimeoutException:
+ os.killpg(os.getpgid(proc.pid), signal.SIGTERM)
+ raise
expected_output = expected_output.replace("\r", "")
if not expected_input:
error_msg = "Expected Output is\n{0} ".\