Skip to content

Instantly share code, notes, and snippets.

@ulises
Created June 6, 2014 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ulises/4f6729e19ce3f1e6a2e7 to your computer and use it in GitHub Desktop.
Save ulises/4f6729e19ce3f1e6a2e7 to your computer and use it in GitHub Desktop.
def run(exe):
p = Popen(exe, stdout=PIPE, stderr=STDOUT)
while(True):
retcode = p.poll() #returns None while subprocess is running
line = p.stdout.readline()
yield line
if(retcode is not None):
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment