Skip to content

Commit

Permalink
Add a buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
weilycoder committed Dec 2, 2024
1 parent 69a01ed commit 60f93ba
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cyaron/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def input_clear_content(self, pos: int = 0):
self.__clear(self.input_file, pos)

def output_gen(
self, shell_cmd: str, time_limit: float = None, replace_EOL: bool = True
self, shell_cmd: str, time_limit: float = None, *, replace_EOL: bool = True
):
"""
Run the command `shell_cmd` (usually the std program) and send it the input file as stdin.
Expand Down Expand Up @@ -279,7 +279,11 @@ def output_gen(

if replace_EOL:
temp_outfile.seek(0)
self.output_file.write(temp_outfile.read())
buf = temp_outfile.read(65536)
while buf != '':
self.output_file.write(buf)
buf = temp_outfile.read(65536)
temp_outfile.close()

log.debug(self.output_filename, " done")

Expand Down

0 comments on commit 60f93ba

Please sign in to comment.