diff options
author | Prabhu Ramachandran | 2017-04-27 17:28:44 +0530 |
---|---|---|
committer | GitHub | 2017-04-27 17:28:44 +0530 |
commit | a67f8597da19527669b596fab08083a18c7e1fcc (patch) | |
tree | 26484d05a23223df13aabb42fe674ce759e09187 /yaksh/hook_evaluator.py | |
parent | ea9e60c47b763515b324aa507da06a1e91c488c6 (diff) | |
parent | 4a8f9a117f6a784fe722b8b381368c41be86024a (diff) | |
download | online_test-a67f8597da19527669b596fab08083a18c7e1fcc.tar.gz online_test-a67f8597da19527669b596fab08083a18c7e1fcc.tar.bz2 online_test-a67f8597da19527669b596fab08083a18c7e1fcc.zip |
Merge pull request #274 from maheshgudi/kill_stray_processes
Kill stray processes
Diffstat (limited to 'yaksh/hook_evaluator.py')
-rw-r--r-- | yaksh/hook_evaluator.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/yaksh/hook_evaluator.py b/yaksh/hook_evaluator.py index 0819ec9..f5364d6 100644 --- a/yaksh/hook_evaluator.py +++ b/yaksh/hook_evaluator.py @@ -2,6 +2,8 @@ import sys import traceback import os +import signal +import psutil # Local imports from .file_utils import copy_files, delete_files @@ -65,10 +67,12 @@ class HookEvaluator(BaseEvaluator): check = hook_scope["check_answer"] success, err, mark_fraction = check(self.user_answer) except TimeoutException: + processes = psutil.Process(os.getpid()).children(recursive=True) + for process in processes: + process.kill() raise except Exception: msg = traceback.format_exc(limit=0) err = "Error in Hook code: {0}".format(msg) del tb return success, err, mark_fraction -
\ No newline at end of file |