some code...

This commit is contained in:
Johannes Findeisen 2013-05-16 23:03:00 +02:00
commit cac342582b
19 changed files with 788 additions and 0 deletions

28
lib/core/command.py Normal file
View file

@ -0,0 +1,28 @@
import subprocess
class Command:
def __init__(self, command):
self.command = command
self.output = ""
self.error = ""
def __str__(self):
return command
def hasProcessed(self):
return self.output != "" and self.error != ""
def doProcess(self):
process = subprocess.Popen([self.command], stdout=subprocess.PIPE)
self.output, self.error = process.communicate()
def getOutput(self):
if not self.hasProcessed():
self.doProcess()
return self.output
def getError(self):
if not self.hasProcessed():
self.doProcess()
return self.error