Skip to content

Commit cf66e4e

Browse files
committed
Add a buffer
1 parent 69a01ed commit cf66e4e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cyaron/io.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def input_clear_content(self, pos: int = 0):
244244
self.__clear(self.input_file, pos)
245245

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

280280
if replace_EOL:
281281
temp_outfile.seek(0)
282-
self.output_file.write(temp_outfile.read())
282+
buf = temp_outfile.read()
283+
while buf != '':
284+
self.output_file.write(buf)
285+
buf = temp_outfile.read()
286+
temp_outfile.close()
283287

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

0 commit comments

Comments
 (0)