switched to Popen, with errors...

This commit is contained in:
Rafael.Timmerberg 2013-05-29 23:51:12 +02:00
commit ee38ba781b
2 changed files with 7 additions and 6 deletions

View file

@ -26,10 +26,11 @@ class Command:
try: try:
self.commandStart = dt.now() self.commandStart = dt.now()
self.log.d("calling command " + str(self.command) + " at " + str(self.commandStart)) self.log.d("calling command " + str(self.command) + " at " + str(self.commandStart))
self.output=sp.check_output(self.command.split()) #self.output=sp.check_output(self.command.split())
#process = Popen(stdout=PIPE, *popenargs, **kwargs) process = Popen(stdout=PIPE, *self.command.split())
#self.output, self.error = process.communicate() self.output, self.error = process.communicate()
#self.retcode = process.poll() self.log.d(str(self.output) + str(self.error))
self.retcode = process.poll()
except CalledProcessError: except CalledProcessError:
self.error=CalledProcessError.output self.error=CalledProcessError.output
self.retcode = CalledProcessError.returncode self.retcode = CalledProcessError.returncode
@ -42,7 +43,7 @@ class Command:
def getError(self): def getError(self):
return self.error return self.error
def getOutputAll(self): def getAllOutput(self):
return str(self.output) + str(self.error) + str(self.retcode) return str(self.output) + str(self.error) + str(self.retcode)
def getReturnCode(self): def getReturnCode(self):

View file

@ -48,7 +48,7 @@ class JobInfo:
self.log.d(str(hs)) self.log.d(str(hs))
cmd=Command(hs.service.command, self.log) cmd=Command(hs.service.command, self.log)
cmd.call() cmd.call()
log.d(cmd.getOutputOrError()) self.log.d(cmd.getAllOutput())
except Error: except Error:
self.log.d(Error) self.log.d(Error)