Skip to content

Instantly share code, notes, and snippets.

@rreece
Created March 11, 2023 02:22
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 rreece/4f8c84501f6f15ac0e086a5cd430e2d8 to your computer and use it in GitHub Desktop.
Save rreece/4f8c84501f6f15ac0e086a5cd430e2d8 to your computer and use it in GitHub Desktop.
run a process in shell and get its output
import subprocess
def run_shell(cmd):
out = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True, encoding="UTF-8")
return out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment