Last active
April 8, 2020 11:35
-
-
Save freinold/5d13ee176b59d3b20a25612d53c4ab44 to your computer and use it in GitHub Desktop.
python3 bash call (Subprocess)
This file contains 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 _bash(cmd: str) -> str: | |
logging.debug("Bash Command: {0}".format(cmd)) | |
output: str = subprocess.run( | |
cmd, | |
shell=True, | |
check=True, | |
executable="/bin/bash", | |
capture_output=True, | |
text=True | |
).stdout | |
logging.debug("Command Output: {0}".format(output)) | |
return output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment