Last active
August 31, 2021 18:48
-
-
Save qtfkwk/696d250c48f37095b4916bb13e052b5a to your computer and use it in GitHub Desktop.
ez command runner
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
from subprocessing import Popen, PIPE | |
class run: | |
def __init__(self, cmd, stdin=None, ttl=None): | |
self.cmd, self.stdin, self.ttl = cmd, stdin, ttl | |
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) | |
self.stdout, self.stderr = p.communicate(stdin, ttl) | |
self.code = p.wait() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment