Update shell_execute.py

This commit is contained in:
qiaofeng1227 2023-02-22 14:50:10 +08:00 committed by GitHub
parent b4ff55352a
commit 16a5168297
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,8 +60,8 @@ def execute_command_output_all(cmd_str, max_time = 3):
while excutetime < max_time: while excutetime < max_time:
process = subprocess.run(cmd_str, shell=True, stdout=subprocess.PIPE, universal_newlines=True) process = subprocess.run(cmd_str, shell=True, stdout=subprocess.PIPE, universal_newlines=True)
if process.returncode == 0: if process.returncode == 0:
return process.stdout return {"code": "0", "result": process.stdout,}
else: else:
excutetime = excutetime + 1 excutetime = excutetime + 1
return "command excute failed, please check your command!" return {"code": "-1", "result": "command excute failed, please check your command!"}