daily pastebin goal
52%
SHARE
TWEET

Untitled

rajkosto Jun 13th, 2018 31 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def realtime_run(totalArgs):
  2.     process = subprocess.Popen(totalArgs, bufsize=0, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
  3.     while True:
  4.         nextline = process.stdout.readline()
  5.         if nextline == '' and process.poll() is not None:
  6.             break
  7.         sys.stdout.write(nextline)
  8.         sys.stdout.flush()
  9.  
  10.     output = process.communicate()[0]
  11.     exitCode = process.returncode
  12.  
  13.     if (exitCode == 0):
  14.         return output
  15.     else:
  16.         raise subprocess.CalledProcessError(exitCode, " ".join(totalArgs), output)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top