def __execute(self, cmd): retcode = commands.getstatusoutput(cmd) status, text = retcode conf.bash_log(cmd, status, text) # print "------------------------------------------------------------" # print "cmd: %s" % cmd # print "sta: %s" % status # print "out: %s" % text return retcode
def get_output(self, code_override=None): text_output = "before:\n{before}\nafter:\n{after}".format( before = self.before if isinstance(self.before, basestring) else pformat(self.before, indent=4), after = self.after if isinstance(self.after, basestring) else pformat(self.after, indent=4)) if code_override is not None: conf.bash_log(pformat(self.args), code_override, text_output) return code_override, text_output if self.isalive(): conf.bash_log(pformat(self.args), 'Spawned process running: pid={pid}'.format(pid=self.pid), text_output) raise pexpect.ExceptionPexpect('Unable to return exit code. Spawned command is still running:\n' + text_output) conf.bash_log(pformat(self.args), self.exitstatus, text_output) return self.exitstatus, text_output
def get_output(self, code_override=None): text_output = "before:\n{before}\nafter:\n{after}".format( before=self.before if isinstance( self.before, basestring) else pformat(self.before, indent=4), after=self.after if isinstance( self.after, basestring) else pformat(self.after, indent=4)) if code_override is not None: conf.bash_log(pformat(self.args), code_override, text_output) return code_override, text_output if self.isalive(): conf.bash_log( pformat(self.args), 'Spawned process running: pid={pid}'.format(pid=self.pid), text_output) raise pexpect.ExceptionPexpect( 'Unable to return exit code. Spawned command is still running:\n' + text_output) conf.bash_log(pformat(self.args), self.exitstatus, text_output) return self.exitstatus, text_output
def __execute(self, cmd): text, status = pexpect.run(cmd,withexitstatus=True) conf.bash_log(cmd, status, text) return status, text
def __execute(self, cmd): retcode = commands.getstatusoutput(cmd) status, text = retcode conf.bash_log(cmd, status, text) return retcode
def __execute(self, cmd): text, status = pexpect.run(cmd, withexitstatus=True) conf.bash_log(cmd, status, text) return status, text