Skip to content

Instantly share code, notes, and snippets.

@claymcleod
Created February 14, 2017 02:40
Show Gist options
  • Save claymcleod/5c5cf3fa5094a2b68db4fc6bab377863 to your computer and use it in GitHub Desktop.
Save claymcleod/5c5cf3fa5094a2b68db4fc6bab377863 to your computer and use it in GitHub Desktop.
import subprocess
def cmd(line):
complete_cmd = subprocess.run(
line, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return {'stdout': complete_cmd.stdout, 'stderr': complete_cmd.stderr}
print(cmd("echo 'hello, world'"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment