update arrpc

This commit is contained in:
smartfrigde 2023-07-27 17:19:27 +02:00
parent 6c0215313c
commit d0d37caa05

View file

@ -2,16 +2,16 @@ const {exec} = require("child_process");
const getProcesses = () => const getProcesses = () =>
new Promise((res) => new Promise((res) =>
exec(`wmic process get ProcessID,ExecutablePath /format:csv`, (e, out) => { exec(`wmic process get ProcessID,ExecutablePath,Name /format:csv`, (e, out) => {
res( res(
out out
.toString() .toString()
.split("\r\n") .split("\r\n")
.slice(2) .slice(2)
.map((x) => { .map((x) => {
// [ProcessId, Name, ExecutablePath]
const parsed = x.trim().split(",").slice(1).reverse(); const parsed = x.trim().split(",").slice(1).reverse();
parsed[0] = parseInt(parsed[0]) || parsed[0]; // pid to int return [parseInt(parsed[0]) || parsed[0], parsed[2] || parsed[1]];
return parsed;
}) })
.filter((x) => x[1]) .filter((x) => x[1])
); );