feat: Discord's local RPC servers
arRPC (https://github.com/OpenAsar/arrpc)
This commit is contained in:
25
src/util/arRPC/process/native/win32.js
Normal file
25
src/util/arRPC/process/native/win32.js
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
const { exec } = require('child_process');
|
||||
|
||||
const getProcesses = () =>
|
||||
new Promise(res =>
|
||||
exec(`wmic process get ProcessID,ExecutablePath /format:csv`, (e, out) => {
|
||||
res(
|
||||
out
|
||||
.toString()
|
||||
.split('\r\n')
|
||||
.slice(2)
|
||||
|
||||
.map(x => {
|
||||
// eslint-disable-next-line newline-per-chained-call
|
||||
const parsed = x.trim().split(',').slice(1).reverse();
|
||||
parsed[0] = parseInt(parsed[0]) || parsed[0]; // Pid to int
|
||||
return parsed;
|
||||
})
|
||||
.filter(x => x[1]),
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
module.exports = { getProcesses };
|
||||
Reference in New Issue
Block a user