Created
July 8, 2014 03:54
-
-
Save sapamja/36b647c37ca753fdfc48 to your computer and use it in GitHub Desktop.
class to execute shell cmd
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
class Command(object): | |
def __init__(self, args): | |
self.cmd_args = args | |
def __call__(self): | |
(self.out, self.err) = subprocess.Popen(self.cmd_args, | |
stdout=subprocess.PIPE, | |
stderr=subprocess.PIPE, | |
shell=True).communicate() | |
@property | |
def output(self): | |
return self.out | |
@property | |
def error(self): | |
return self.err |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment