From 16a5168297a86a18fd5b41e7bacde37990f62fe1 Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Wed, 22 Feb 2023 14:50:10 +0800 Subject: [PATCH] Update shell_execute.py --- appmanage/api/utils/shell_execute.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appmanage/api/utils/shell_execute.py b/appmanage/api/utils/shell_execute.py index 418640f9..4b71d52a 100644 --- a/appmanage/api/utils/shell_execute.py +++ b/appmanage/api/utils/shell_execute.py @@ -60,8 +60,8 @@ def execute_command_output_all(cmd_str, max_time = 3): while excutetime < max_time: process = subprocess.run(cmd_str, shell=True, stdout=subprocess.PIPE, universal_newlines=True) if process.returncode == 0: - return process.stdout + return {"code": "0", "result": process.stdout,} else: excutetime = excutetime + 1 - return "command excute failed, please check your command!" + return {"code": "-1", "result": "command excute failed, please check your command!"}