write to stderr and flush
This commit is contained in:
parent
8767374bfa
commit
f1129354bd
@ -1,6 +1,7 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
import sys
|
||||||
|
|
||||||
def logrun(cmd, file, timeout):
|
def logrun(cmd, file, timeout):
|
||||||
with open(file, 'w') as outf:
|
with open(file, 'w') as outf:
|
||||||
@ -11,10 +12,11 @@ def logrun(cmd, file, timeout):
|
|||||||
with open(file, 'r') as inf:
|
with open(file, 'r') as inf:
|
||||||
contents = inf.read()
|
contents = inf.read()
|
||||||
if len(contents) > len(oldContents):
|
if len(contents) > len(oldContents):
|
||||||
print(contents[len(oldContents):], end="")
|
sys.stderr.write(contents[len(oldContents):])
|
||||||
|
sys.stderr.flush()
|
||||||
oldContents = contents
|
oldContents = contents
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print()
|
sys.stderr.write("\n")
|
||||||
if p.poll() is None:
|
if p.poll() is None:
|
||||||
return ("TIMEOUT", contents)
|
return ("TIMEOUT", contents)
|
||||||
return (p.returncode, contents)
|
return (p.returncode, contents)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user