[Profiler] Make sure grep pattern includes all node processes (#218430)

previously we only matched processes that looked like:
`000 node scripts/`

but we should actually match:

`000 /.../node/v20.18.2/bin/node scripts/`
This commit is contained in:
Dario Gieselaar 2025-04-17 13:30:49 +02:00 committed by GitHub
parent 35407c9240
commit ead7426c6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,7 +12,7 @@ export async function getNodeProcesses(
): Promise<Array<{ pid: number; command: string; ports: number[] }>> {
const candidates = await execa
.command(
`ps -eo pid,command | grep -E '^[[:space:]0-9]+[[:space:]]*node[[:space:]]?' | grep -v grep ${
`ps -eo pid,command | grep -E '^[[:space:]]*[0-9]+[[:space:]]+([^[:space:]]+/)*node($|[[:space:]])' | grep -v grep ${
grep ? `| grep "${grep}" ` : ''
}`,
{ shell: true, reject: false }