MCPcopy Index your code
hub / github.com/Tencent/CodeAnalysis / kill_scc_process

Method kill_scc_process

client/util/codecount/localcount.py:121–137  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

119 return stat_result
120
121 def kill_scc_process(self):
122 scc_workdir = PathMgr().format_path(self._task_dir)
123 pids = psutil.pids()
124 for pid in pids:
125 try:
126 # 运行时候可能刚好有个进程退出,导致出现找不到进程错误
127 # 2020/4/28 windows的进程命令不一样,并且杀进程时候不一定三个子进程已经起起来
128 p = psutil.Process(pid)
129 # children = p.children()
130 # LogPrinter.info(f"pid: {pid}")
131 # LogPrinter.info(f"pname: {p.name()}")
132 if p.name().lower().startswith("scc") and " ".join(p.cmdline()).find(scc_workdir) != -1:
133 LogPrinter.info(f"find and kill scc process, pid: {pid}, "
134 f"pname: {p.name()}, cmdline: {' '.join(p.cmdline())}")
135 ProcMgr().kill_proc_famliy(pid)
136 except Exception as e:
137 LogPrinter.warning("kill scc process failed: %s" % str(e))

Callers 1

get_resultMethod · 0.95

Calls 4

ProcMgrClass · 0.90
kill_proc_famliyMethod · 0.80
warningMethod · 0.80
infoMethod · 0.45

Tested by

no test coverage detected