Commit 49d475f1 authored by Mike Day's avatar Mike Day Committed by yonghong-song

provide a parameter to suppress printing a new line at the end of the bytes (#1930)

provide a parameter to suppress printing a new line at the end of the bytes.
existing behavior is not changed.
parent ecfbc749
...@@ -45,7 +45,7 @@ def detect_language(candidates, pid): ...@@ -45,7 +45,7 @@ def detect_language(candidates, pid):
FILESYSTEMENCODING = sys.getfilesystemencoding() FILESYSTEMENCODING = sys.getfilesystemencoding()
def printb(s, file=sys.stdout): def printb(s, file=sys.stdout, nl=1):
""" """
printb(s) printb(s)
...@@ -54,7 +54,8 @@ def printb(s, file=sys.stdout): ...@@ -54,7 +54,8 @@ def printb(s, file=sys.stdout):
buf = file.buffer if hasattr(file, "buffer") else file buf = file.buffer if hasattr(file, "buffer") else file
buf.write(s) buf.write(s)
buf.write(b"\n") if nl:
buf.write(b"\n")
file.flush() file.flush()
class ArgString(object): class ArgString(object):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment