Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def realtime_run(totalArgs):
- process = subprocess.Popen(totalArgs, bufsize=0, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
- while True:
- nextline = process.stdout.readline()
- if nextline == '' and process.poll() is not None:
- break
- sys.stdout.write(nextline)
- sys.stdout.flush()
- output = process.communicate()[0]
- exitCode = process.returncode
- if (exitCode == 0):
- return output
- else:
- raise subprocess.CalledProcessError(exitCode, " ".join(totalArgs), output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement