diff options
author | prathamesh | 2013-07-03 12:41:00 +0530 |
---|---|---|
committer | prathamesh | 2013-07-03 12:41:00 +0530 |
commit | 781842c523ccf11b85e0be06e884b2cd585f3cb9 (patch) | |
tree | 2c4ad65fdbc28ec5d5616e984e5baf3666b005d6 /testapp/code_server.py | |
parent | eee6362ab994bc0082fdc777c225773318978b1a (diff) | |
download | online_test-781842c523ccf11b85e0be06e884b2cd585f3cb9.tar.gz online_test-781842c523ccf11b85e0be06e884b2cd585f3cb9.tar.bz2 online_test-781842c523ccf11b85e0be06e884b2cd585f3cb9.zip |
clean code
Diffstat (limited to 'testapp/code_server.py')
-rwxr-xr-x | testapp/code_server.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/testapp/code_server.py b/testapp/code_server.py index 19c70b1..a3513b7 100755 --- a/testapp/code_server.py +++ b/testapp/code_server.py @@ -204,8 +204,8 @@ class CodeServer(object): except TimeoutException: # Runaway code, so kill it. proc.kill() - stderr = self.timeout_msg - stdout = '' + # Re-raise exception. + raise return proc, stdout, stderr def check_bash_script(self, ref_script_path, submit_script_path, @@ -398,9 +398,7 @@ class CodeServer(object): success = False output_path = os.getcwd() + '/output' compile_command = "g++ %s -c -o %s" % (submit_code_path, output_path) - ret = self._compile_command(compile_command, stdin=None, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + ret = self._compile_command(compile_command) proc, inst_stderr = ret # Only if compilation is successful, the program is executed @@ -409,9 +407,7 @@ class CodeServer(object): executable = os.getcwd() + '/executable' compile_main = "g++ %s %s -o %s" % (ref_code_path, output_path, executable) - ret = self._compile_command(compile_main, stdin=None, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + ret = self._compile_command(compile_main) proc, main_err = ret if main_err == '': args = [executable] @@ -423,7 +419,6 @@ class CodeServer(object): success, err = True, "Correct answer" else: err = stdout + "\n" + stderr - success = False os.remove(executable) else: err = "Error:" @@ -433,7 +428,6 @@ class CodeServer(object): err = err + "\n" + e.split(":", 1)[1] except: err = err + "\n" + main_err - success = False os.remove(output_path) else: err = "Compilation Error:" |