Commit be9ad02d authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

tools/ unbuffered

parent 918dd37f
......@@ -19,15 +19,22 @@ parser.add_argument('file', nargs='*', help='''output file(s)''')
def unbuffered_read(f):
# see
l = f.readline()
while l:
yield l
l = f.readline()
def tee(cmd, outputs):
'''Runs 'cmd', pipe the output to 'outputs', and returns the exit code of 'cmd' '''
argz = shlex.split(cmd)
p = subprocess.Popen(argz,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
for l in p.stdout:
for l in unbuffered_read(p.stdout):
for o in outputs:
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