Rename output -> stdout, add stderr.

master
voussoir 2020-12-07 20:08:39 -08:00
parent 0a1a3a545e
commit 6873beb823
1 changed files with 13 additions and 4 deletions

View File

@ -130,12 +130,21 @@ def input(
continue continue
yield line yield line
def output(line, end='\n'): def _output(stream, line, end):
sys.stdout.write(line) stream.write(line)
if not line.endswith(end): if not line.endswith(end):
sys.stdout.write(end) stream.write(end)
if not OUT_PIPE: if not OUT_PIPE:
sys.stdout.flush() stream.flush()
def stdout(line, end='\n'):
_output(sys.stdout, line, end)
def stderr(line, end='\n'):
_output(sys.stderr, line, end)
# backwards compat
output = stdout
def go(args=None, *input_args, **input_kwargs): def go(args=None, *input_args, **input_kwargs):
''' '''