Skip to content

Instantly share code, notes, and snippets.

@sapamja
Created July 8, 2014 03:54
Show Gist options
  • Save sapamja/36b647c37ca753fdfc48 to your computer and use it in GitHub Desktop.
Save sapamja/36b647c37ca753fdfc48 to your computer and use it in GitHub Desktop.
class to execute shell cmd
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