|
@@ -22,7 +22,7 @@ with open(log_file, 'w') as f:
|
|
text=True)
|
|
text=True)
|
|
|
|
|
|
# 检查script1.sh的返回码,并写入输出到日志文件
|
|
# 检查script1.sh的返回码,并写入输出到日志文件
|
|
- if result1.returncode == 0:
|
|
|
|
|
|
+ if result1.returncode == 0 and not result1.stderr:
|
|
print("script1.sh 执行成功")
|
|
print("script1.sh 执行成功")
|
|
f.write(f"--- script1.sh 输出 ---\n{result1.stdout}\n")
|
|
f.write(f"--- script1.sh 输出 ---\n{result1.stdout}\n")
|
|
|
|
|
|
@@ -30,7 +30,7 @@ with open(log_file, 'w') as f:
|
|
result2 = subprocess.run([script2_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
|
result2 = subprocess.run([script2_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
|
|
|
|
|
# 检查script2.sh的返回码,并写入输出到日志文件
|
|
# 检查script2.sh的返回码,并写入输出到日志文件
|
|
- if result2.returncode == 0:
|
|
|
|
|
|
+ if result2.returncode == 0 and not result2.stderr:
|
|
print("script2.sh 执行成功")
|
|
print("script2.sh 执行成功")
|
|
f.write(f"--- script2.sh 输出 ---\n{result2.stdout}\n")
|
|
f.write(f"--- script2.sh 输出 ---\n{result2.stdout}\n")
|
|
else:
|
|
else:
|