Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling output file in DOMjudge reactive problem #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions rime/plugins/judge_system/domjudge.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import shutil
import signal
import subprocess
import tempfile
import threading
import time

Expand Down Expand Up @@ -213,17 +212,17 @@ def Run(self, reactive, args, cwd, input, output, timeout, precise):
if os.path.exists(feedback_dir_name):
shutil.rmtree(feedback_dir_name)
os.makedirs(feedback_dir_name, exist_ok=True)
# 2nd argument is an "expected output" file, which is not supported
# in rime interactive for now.
# As a placeholder, using a temporary file.
with tempfile.NamedTemporaryFile() as tmpfile:
judge_args = reactive.run_args + \
(input, tmpfile.name, feedback_dir_name, )
solution_args = args
task = DOMJudgeReactiveTask(
judge_args, solution_args,
cwd=cwd, timeout=timeout, exclusive=precise)
(judge_proc, solution_proc) = yield task

# Makes sure output file exists.
open(output, 'w').close()

judge_args = reactive.run_args + \
(input, output, feedback_dir_name, )
solution_args = args
task = DOMJudgeReactiveTask(
judge_args, solution_args,
cwd=cwd, timeout=timeout, exclusive=precise)
(judge_proc, solution_proc) = yield task

judge_code = judge_proc.returncode
solution_code = solution_proc.returncode
Expand Down