Skip to content

Instantly share code, notes, and snippets.

@professorjamesmoriarty
Created April 13, 2016 19:31
Show Gist options
  • Save professorjamesmoriarty/e18941740175b26ff325e5e7c564be61 to your computer and use it in GitHub Desktop.
Save professorjamesmoriarty/e18941740175b26ff325e5e7c564be61 to your computer and use it in GitHub Desktop.
from subprocess import Popen, PIPE
def run_cmd(cmd):
p = Popen(cmd, shell=True, stdout=PIPE)
out = p.communicate()
return out
result = run_cmd('ls -l')
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment