processes() improved command parsing

This commit is contained in:
Sebastian Hildebrandt 2022-06-24 18:55:56 +02:00
parent aa09172366
commit a11719984f

View File

@ -586,6 +586,13 @@ function processes(callback) {
if (fullcommand.substr(fullcommand.length - 1) === ']') { fullcommand = fullcommand.slice(0, -1); }
if (fullcommand.substr(0, 1) === '[') { command = fullcommand.substring(1); }
else {
const p1 = fullcommand.indexOf('(');
const p2 = fullcommand.indexOf(')');
const p3 = fullcommand.indexOf('/');
if (p1 < p2 && p1 < p3 && p3 < p2) {
command = fullcommand.split(' ')[0];
command = command.replace(/:/g, '');
} else {
// try to figure out where parameter starts
let firstParamPos = fullcommand.indexOf(' -');
let firstParamPathPos = fullcommand.indexOf(' /');
@ -615,6 +622,8 @@ function processes(callback) {
}
}
}
return ({
pid: pid,
parentPid: ppid,