mirror of
https://github.com/Websoft9/websoft9.git
synced 2025-01-23 17:40:35 +08:00
Update shell_execute.py
This commit is contained in:
parent
17ae6182ef
commit
71363a1f03
@ -14,7 +14,9 @@ def execute_command_output_all(cmd_str, max_time = 3):
|
||||
myLogger.info_logger("Start to execute cmd: " + cmd_str)
|
||||
execute_time = 0
|
||||
while execute_time < max_time:
|
||||
process = subprocess.run(convert_command(cmd_str), capture_output=True, check=True, text=True, shell=True)
|
||||
process = subprocess.run(f'nsenter -m -u -i -n -p -t 1 sh -c "{cmd_str}"', capture_output=True, check=True, text=True, shell=True)
|
||||
|
||||
myLogger.info_logger("execute success: " + cmd_str)
|
||||
if process.returncode == 0:
|
||||
return {"code": "0", "result": process.stdout,}
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user