本文整理汇总了Python中mozprocess.ProcessHandler.processOutput方法的典型用法代码示例。如果您正苦于以下问题:Python ProcessHandler.processOutput方法的具体用法?Python ProcessHandler.processOutput怎么用?Python ProcessHandler.processOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mozprocess.ProcessHandler
的用法示例。
在下文中一共展示了ProcessHandler.processOutput方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: perform_build
# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import processOutput [as 别名]
def perform_build(self, history_line):
import pdb
pdb.set_trace()
self.build_number += 1
self.start_time = datetime.now()
log.debug("Performing build %d on history line: %s" % (self.build_number, history_line))
build_proc = ProcessHandler(cmd = ['/home/ctalbert/projects/b2g-hamachi/build.sh'],
cwd = self.build_info['workdir'],
env=self.build_info['env'],
processOutputLine=[self.notify_status],
kill_on_timeout=True,
onTimeout=[self.notify_timeout],
onFinish=[self.notify_finished],
shell=True)
try:
sys.stdout.write("Starting Build %d:" % self.build_number)
build_proc.run(timeout=7200)
build_proc.processOutput()
exitcode = build_proc.wait()
except (KeyboardInterrupt, SystemExit):
print "User Canceled Operation!"
log.debug("Build canceled by user")
raise
finally:
self.build_log.close()
if exitcode == 0:
print "Build %d Completed Successfully" % self.build_number
log.debug("Build %d for history line: %s completed successfully" % (self.build_number, history_line))
else:
print "Build %d Failed" % self.build_number
log.debug("Build %d for history line: %s FAILED" % (self.build_number, history_line))
示例2: execute_cmd
# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import processOutput [as 别名]
def execute_cmd(cmd, cwd):
print 'executing', cmd
proc = ProcessHandler(cmd, cwd=cwd)
proc.processOutput(timeout=180)
assert(proc.waitForFinish() == 0)