Rename output -> stdout, add stderr.
This commit is contained in:
parent
0a1a3a545e
commit
6873beb823
1 changed files with 13 additions and 4 deletions
|
@ -130,12 +130,21 @@ def input(
|
|||
continue
|
||||
yield line
|
||||
|
||||
def output(line, end='\n'):
|
||||
sys.stdout.write(line)
|
||||
def _output(stream, line, end):
|
||||
stream.write(line)
|
||||
if not line.endswith(end):
|
||||
sys.stdout.write(end)
|
||||
stream.write(end)
|
||||
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):
|
||||
'''
|
||||
|
|
Loading…
Reference in a new issue