Skip to content

Commit

Permalink
Merge pull request #119 from DarkLii/master
Browse files Browse the repository at this point in the history
fix: 进程号太长无法杀掉进程,完善kill_process方法
  • Loading branch information
mikigo authored Oct 23, 2024
2 parents b274b27 + 46f9c4e commit 53b4ef9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmdctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def kill_process(cls, process, grep_list: [list, tuple] = None):
cmd = ""
for i in cls.GREP_LIST:
cmd += f"grep -v {i} | "
os.system(f"ps -ef | grep {process} | {cmd}cut -c 9-15 | xargs kill -9 > /dev/null 2>&1")
os.system(f"ps -ef | grep {process} | {cmd}awk '{{print $2}}' | xargs kill -9 > /dev/null 2>&1")

@classmethod
def sudo_kill_process(cls, process, grep_list: [list, tuple] = None):
Expand Down

0 comments on commit 53b4ef9

Please sign in to comment.