我正在python中编写一个运行批处理文件的脚本,批处理完成后会继续执行更多操作。
我编写了执行批处理的代码并等待它完成。问题是如果批处理失败,脚本不知道它。 如果批处理成功完成或失败,批处理将打印到控制台。 我需要你的帮助,以便了解如何使用脚本
将批量打印读取到控制台这是相关代码:
def runAutoFa(self):
process = Popen([self._batPath], cwd = path, stdin = PIPE)
process.stdin.write(self._commit)
time.sleep(2)
process.stdin.write(self._product)
time.sleep(2)
process.stdin.write(self._setupName)
time.sleep(2)
process.stdin.close()
status = process.wait() # The command waits until the batch is finised
self._logger.flush()
return status
我需要能够在继续编写脚本
之前等待批处理完成时读取打印件谢谢!