Skip to content

Instantly share code, notes, and snippets.

@Alquimista
Last active February 23, 2019 17:12
Show Gist options
  • Save Alquimista/d6947134587b3b392af9 to your computer and use it in GitHub Desktop.
Save Alquimista/d6947134587b3b392af9 to your computer and use it in GitHub Desktop.
def run_command(command):
process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE)
while True:
output = process.stdout.readline()
if output == '' and process.poll() is not None:
break
if output:
self.logger.info(output.strip())
rc = process.poll()
return rc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment