我将如何更正此代码以使用 subprocess 模块替换 popen2?
popen3 = popen2.Popen3(cmd, capturestderr=True)
rc = popen3.wait()
if os.WIFEXITED(rc):
rc = os.WEXITSTATUS(rc)
if rc < 0:
#""" Needed to make sure that catastrophic errors are not processed here, hence the rc check.
#"""
if len(stderr) > 0:
inserts= []
inserts.append("Warnings occurred during run of %s" % self.__MODULE_NAME )
inserts.append("Check conversion parameters.")
#self.msgWrite( "98000001", inserts )
if rc == 0:
self.msgDebug("CompartService exited normally", "Exit code with signal: %s" % str(rc))
#