Create shell_execute.py

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

View File

@ -55,8 +55,7 @@ def execute_command_output(cmd_str):
# cmd_str: 执行的command命令 times如果不成功的重复次数
def execute_command_output_all(cmd_str, max_time = 3):
print(cmd_str)
print("start to excute cmd: " + cmd_str)
excutetime = 0
while excutetime < max_time:
process = subprocess.run(cmd_str, shell=True, stdout=subprocess.PIPE, universal_newlines=True)