Force line buffering when output is stdout
For some reason, I had decided that non-stdout output needed to be line buffered, but not stdout? Python will only line buffer stdout by default if it is a TTY, and there are lots of use cases where it is not. And since I started re-opening the output FD, the python executable command line option (-u) no longer works to force it to be unbuffered. Fix #44
This commit is contained in:
parent
35150803ef
commit
f08682af30
1 changed files with 1 additions and 1 deletions
|
@ -110,7 +110,7 @@ def parse_args():
|
|||
def open_out_file(opts, mode):
|
||||
if opts.out_file == "-":
|
||||
# open new file, so it can be closed later without affecting sys.stdout
|
||||
return os.fdopen(sys.stdout.fileno(), "w", closefd=False)
|
||||
return os.fdopen(sys.stdout.fileno(), "w", buffering=1, closefd=False)
|
||||
return open(opts.out_file, mode, buffering=1)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue