Created
March 29, 2021 19:17
-
-
Save max-l/82368034e3cbf6b804885effe6be5839 to your computer and use it in GitHub Desktop.
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
with subprocess.Popen( | |
cmd, | |
stdout=subprocess.PIPE, | |
stderr=subprocess.PIPE, | |
shell=True, | |
text=True | |
) as p: | |
p.wait() | |
if p.returncode != 0: | |
err = p.stderr.read().strip() | |
raise Exception(f"failed:\n{cmd}\n{err}") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment