Created
March 11, 2023 02:22
-
-
Save rreece/4f8c84501f6f15ac0e086a5cd430e2d8 to your computer and use it in GitHub Desktop.
run a process in shell and get its output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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