Do not attempt to close stdin/stdout file objects
This commit is contained in:
parent
8ac344daf2
commit
4a5b924d37
1 changed files with 7 additions and 3 deletions
|
|
@ -3758,8 +3758,12 @@ def start(options, input, output):
|
|||
out_string = scourString(in_string, options).encode("UTF-8")
|
||||
output.write(out_string)
|
||||
|
||||
# Close input and output files
|
||||
# Close input and output files (but do not attempt to close stdin/stdout!)
|
||||
if input is not sys.stdin:
|
||||
if hasattr(input, 'buffer') and input is not sys.stdin.buffer:
|
||||
input.close()
|
||||
if output is not sys.stdout:
|
||||
if hasattr(output, 'buffer') and output is not sys.stdout.buffer:
|
||||
output.close()
|
||||
|
||||
end = walltime()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue