MCPcopy Index your code
hub / github.com/nodejs/node / list_processes_linux

Function list_processes_linux

deps/v8/tools/testrunner/testproc/util.py:19–39  ·  view source on GitHub ↗

Returns list of tuples (pid, command) of processes running in the same out directory as this checkout.

()

Source from the content-addressed store, hash-verified

17
18
19def list_processes_linux():
20 """Returns list of tuples (pid, command) of processes running in the same out
21 directory as this checkout.
22 """
23 if platform.system() != 'Linux':
24 return []
25 try:
26 cmd = 'pgrep -fa %s' % OUT_DIR
27 output = subprocess.check_output(cmd, shell=True, text=True) or ''
28 processes = [
29 (int(line.split()[0]), line[line.index(OUT_DIR):])
30 for line in output.splitlines()
31 ]
32 # Filter strange process with name as out dir.
33 return [p for p in processes if p[1] != OUT_DIR]
34 except subprocess.CalledProcessError as e:
35 # Return code 1 means no processes found.
36 if e.returncode != 1:
37 # TODO(https://crbug.com/v8/13101): Remove after investigation.
38 logging.exception('Fetching process list failed.')
39 return []
40
41
42def kill_processes_linux():

Callers 2

kill_processes_linuxFunction · 0.85
list_processesMethod · 0.85

Calls 5

intFunction · 0.85
exceptionMethod · 0.80
splitMethod · 0.45
indexMethod · 0.45
splitlinesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…