diff --git a/bin/up2k.py b/bin/up2k.py index 54d1caab..58b54640 100755 --- a/bin/up2k.py +++ b/bin/up2k.py @@ -125,17 +125,30 @@ class FileSlice(object): return ret +_print = print + + def eprint(*a, **ka): ka["file"] = sys.stderr ka["end"] = "" if not PY2: ka["flush"] = True - print(*a, **ka) - if PY2: + _print(*a, **ka) + if PY2 or not VT100: sys.stderr.flush() +def flushing_print(*a, **ka): + _print(*a, **ka) + if "flush" not in ka: + sys.stdout.flush() + + +if not VT100: + print = flushing_print + + def termsize(): import os