Update processes.js
increase windows services lookup time for single services also fix incorrect started compare
This commit is contained in:
parent
acf1a89bf2
commit
7b8fa912f6
@ -324,7 +324,16 @@ function services(srv, callback) {
|
|||||||
}
|
}
|
||||||
if (_windows) {
|
if (_windows) {
|
||||||
try {
|
try {
|
||||||
util.powerShell('Get-WmiObject Win32_Service | fl *').then((stdout, error) => {
|
let wincommand = "Get-WmiObject Win32_Service ";
|
||||||
|
if (srvs[0] !== '*') {
|
||||||
|
wincommand += '-Filter "';
|
||||||
|
for (let i = 0; i < srvs.length; i++) {
|
||||||
|
wincommand += `Name='${srvs[i]}' or `;
|
||||||
|
}
|
||||||
|
wincommand = `${wincommand.slice(0,-4)}"`;
|
||||||
|
}
|
||||||
|
wincommand += '| fl *';
|
||||||
|
util.powerShell(wincommand).then((stdout, error) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
let serviceSections = stdout.split(/\n\s*\n/);
|
let serviceSections = stdout.split(/\n\s*\n/);
|
||||||
for (let i = 0; i < serviceSections.length; i++) {
|
for (let i = 0; i < serviceSections.length; i++) {
|
||||||
@ -338,7 +347,7 @@ function services(srv, callback) {
|
|||||||
if (srvString === '*' || srvs.indexOf(srvName) >= 0 || srvs.indexOf(srvCaption) >= 0) {
|
if (srvString === '*' || srvs.indexOf(srvName) >= 0 || srvs.indexOf(srvCaption) >= 0) {
|
||||||
result.push({
|
result.push({
|
||||||
name: srvName,
|
name: srvName,
|
||||||
running: (started === 'TRUE'),
|
running: (started.toLowerCase() === 'true'),
|
||||||
startmode: startMode,
|
startmode: startMode,
|
||||||
pids: [pid],
|
pids: [pid],
|
||||||
cpu: 0,
|
cpu: 0,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user