Skip to content

Commit

Permalink
Fix deadlock when open_input() / open_output() fail.
Browse files Browse the repository at this point in the history
Related to #20
  • Loading branch information
iceboy233 committed Nov 28, 2017
1 parent b10efd9 commit 130bcf9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jd4/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ def __init__(self, open_input, open_output, time_ns, memory_bytes, score):

def do_stdin(self, stdin_file):
try:
with self.open_input() as src, open(stdin_file, 'wb') as dst:
with open(stdin_file, 'wb') as dst, self.open_input() as src:
dos2unix(src, dst)
except BrokenPipeError:
pass

def do_stdout(self, stdout_file):
with self.open_output() as ans, open(stdout_file, 'rb') as out:
with open(stdout_file, 'rb') as out, self.open_output() as ans:
return compare_stream(ans, out)

class APlusBCase(CaseBase):
Expand Down

0 comments on commit 130bcf9

Please sign in to comment.