1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 01:06:17 +02:00

Merge branch 'stderr_line_buffering' of https://github.com/marcus-h/osc

Make stderr line buffered if it does not refer to a tty.
This commit is contained in:
Marcus Huewe 2021-04-02 12:25:44 +02:00
commit fc5470a152

View File

@ -23,6 +23,7 @@ except NameError:
pass
# avoid buffering output on pipes (bnc#930137)
# Note: the following only applies to python2
# Basically, a "print('foo')" call is translated to a corresponding
# fwrite call that writes to the stdout stream (cf. string_print
# (Objects/stringobject.c) and builtin_print (Python/bltinmodule.c));
@ -36,6 +37,9 @@ except NameError:
if not os.isatty(sys.stdout.fileno()):
sys.stdout = os.fdopen(sys.stdout.fileno(), sys.stdout.mode, 1)
if not os.isatty(sys.stderr.fileno()):
sys.stderr = os.fdopen(sys.stderr.fileno(), sys.stderr.mode, 1)
osccli = commandline.Osc()
r = babysitter.run(osccli)