From ad0b361d17595d636ce9190208f4aad6f1e7e25c Mon Sep 17 00:00:00 2001 From: Caohongtao Date: Wed, 28 Feb 2024 03:24:17 +0000 Subject: [PATCH] update common/command.py. Signed-off-by: Caohongtao --- common/command.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/command.py b/common/command.py index 93707b1..f67076f 100644 --- a/common/command.py +++ b/common/command.py @@ -163,6 +163,7 @@ class Command: # ret = subprocess.run('which ' + cmd, shell = True, stdout = subprocess.DEVNULL, stderr = subprocess.DEVNULL, env = env_c) ret = subprocess.Popen('which ' + cmd, shell = True, stdout = devnull, stderr = devnull, env = env_c) ret.communicate() + devnull.close() if 0 == ret.returncode: return True else: @@ -211,11 +212,11 @@ class Command: for item in pid: if item == '-1' and len(pid) != 1: if flag: - Logger().error("pid list contains -1, but length not 1") + Logger().error("Pid list contains -1, but length not 1") return False if item != '-1' and not item.isdigit(): if flag: - Logger().error("process id should be digit number") + Logger().error("Process id should be digit number") return False if item != '-1': return Command.check_pid_exist(item, flag) -- Gitee