This commit is contained in:
dongchangxi committed 2025-01-12 00:00:16 +08:00
1 parent 82dec6d40c
commit fadf6c300e
1 file changed
+9 -9
+9 -9
View File
@@ -106,15 +106,15 @@ def detect_markers(psid, pid):
#res = subprocess.run(cmd)
# ########################################
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# 使用 communicate() 等待进程完成
stdout, stderr = process.communicate()
# 获取进程的退出码
exit_code = process.returncode
print(f"Process exited with code: {exit_code}")
print(f"Output: {stdout.decode()}")
print(f"Error: {stderr.decode()}")
process = subprocess.Popen(cmd, shell=True)
# 获取主进程的 PID
pidddd = process.pid
# 在等待主进程的同时,检查子进程的状态
while process.poll() is None:
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 进程 {pidddd} 运行中...')
# 这里可以使用 os.wait() 等待子进程的退出
time.sleep(2)
print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")