From 5786fcedad30eaa68ab30172d3ca04942a95e2db Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Sun, 17 Oct 2021 19:47:39 -0400 Subject: [PATCH 1/2] cptbox: support `subprocess.STDOUT` Fixes #958, see https://dmoj.ca/submission/3963487 (patched) versus https://dmoj.ca/submission/3963488 (unpatched). --- dmoj/cptbox/tracer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dmoj/cptbox/tracer.py b/dmoj/cptbox/tracer.py index 204b75a11..180057128 100644 --- a/dmoj/cptbox/tracer.py +++ b/dmoj/cptbox/tracer.py @@ -16,6 +16,7 @@ from dmoj.utils.unicode import utf8bytes, utf8text PIPE = subprocess.PIPE +STDOUT = subprocess.STDOUT log = logging.getLogger('dmoj.cptbox') _PIPE_BUF = getattr(select, 'PIPE_BUF', 512) @@ -398,6 +399,8 @@ def __init_streams(self, stdin, stdout, stderr) -> None: self._stderr, self._child_stderr = os.pipe() self.stderr = os.fdopen(self._stderr, 'rb') self.stderr_needs_close = True + elif stderr == STDOUT: + self._stderr, self._child_stderr = -1, self._child_stdout elif isinstance(stderr, int): self._stderr, self._child_stderr = -1, stderr elif stderr is not None: From e33503474385850a72eb65db1c5b0c2b62037349 Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Sun, 17 Oct 2021 20:10:45 -0400 Subject: [PATCH 2/2] PAS: drop NullStdoutMixin Ref #958. For some reason, fpc crashes during compile errors if this is specified, despite never writing to stdout if it isn't. --- dmoj/executors/PAS.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dmoj/executors/PAS.py b/dmoj/executors/PAS.py index 5a1b876b1..658d5d67a 100644 --- a/dmoj/executors/PAS.py +++ b/dmoj/executors/PAS.py @@ -1,9 +1,8 @@ from dmoj.cptbox.filesystem_policies import ExactFile from dmoj.executors.compiled_executor import CompiledExecutor -from dmoj.executors.mixins import NullStdoutMixin -class Executor(NullStdoutMixin, CompiledExecutor): +class Executor(CompiledExecutor): ext = 'pas' name = 'PAS' command = 'fpc'