fix 查询ssh-agent进程,控制台输出不全,导致建立互信失败

This commit is contained in:
liuheng 2024-11-07 14:18:57 +08:00
parent 586fdd9d80
commit cb0caf9160

View File

@ -2576,7 +2576,7 @@ class DefaultValue():
return local_ips
@staticmethod
def get_pid(desc):
def get_pid(desc, width=300):
"""
function : get the ID of the process
that contains the specified content
@ -2584,7 +2584,7 @@ class DefaultValue():
output : list
"""
pids = []
cmd = "ps ux | grep '%s' | grep -v grep" % desc
cmd = "ps ux --width=%s | grep '%s' | grep -v grep" % (width, desc)
proc = FastPopen(cmd, stdout=PIPE, stderr=PIPE)
stdout, stderr = proc.communicate()
if stderr: