processes() fix parsing command and params
This commit is contained in:
parent
ba24765cfb
commit
7715043a42
@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| -------------- | -------------- | -------- |
|
| -------------- | -------------- | -------- |
|
||||||
|
| 4.24.1 | 2020-05-03 | `processes()` fix parsing command and params |
|
||||||
| 4.24.0 | 2020-05-01 | `networkInterfaces()` added subnet mask ip4 and ip6 |
|
| 4.24.0 | 2020-05-01 | `networkInterfaces()` added subnet mask ip4 and ip6 |
|
||||||
| 4.23.10 | 2020-05-01 | `cpuTemperature()` optimized parsing linux |
|
| 4.23.10 | 2020-05-01 | `cpuTemperature()` optimized parsing linux |
|
||||||
| 4.23.9 | 2020-04-29 | `currentLoad()` workarround for no os.cpus info |
|
| 4.23.9 | 2020-04-29 | `currentLoad()` workarround for no os.cpus info |
|
||||||
|
|||||||
@ -83,6 +83,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">4.24.1</th>
|
||||||
|
<td>2020-05-03</td>
|
||||||
|
<td><span class="code">processes()</span> fix parsing command and params (linux, macOS) /td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">4.24.0</th>
|
<th scope="row">4.24.0</th>
|
||||||
<td>2020-05-01</td>
|
<td>2020-05-01</td>
|
||||||
|
|||||||
@ -168,7 +168,7 @@
|
|||||||
<img class="logo" src="assets/logo.png">
|
<img class="logo" src="assets/logo.png">
|
||||||
<div class="title">systeminformation</div>
|
<div class="title">systeminformation</div>
|
||||||
<div class="subtitle"><span id="typed"></span></div>
|
<div class="subtitle"><span id="typed"></span></div>
|
||||||
<div class="version">Current Version: <span id="version">4.24.0</span></div>
|
<div class="version">Current Version: <span id="version">4.24.1</span></div>
|
||||||
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
|
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="down">
|
<div class="down">
|
||||||
|
|||||||
@ -14,6 +14,8 @@
|
|||||||
// ----------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
const exec = require('child_process').exec;
|
const exec = require('child_process').exec;
|
||||||
const execSync = require('child_process').execSync;
|
const execSync = require('child_process').execSync;
|
||||||
|
|
||||||
@ -436,6 +438,7 @@ function processes(callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function parseLine(line) {
|
function parseLine(line) {
|
||||||
|
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
let offset2 = 0;
|
let offset2 = 0;
|
||||||
|
|
||||||
@ -472,7 +475,7 @@ function processes(callback) {
|
|||||||
const user = line.substring(parsedhead[11].from + offset, parsedhead[11].to + offset2).trim();
|
const user = line.substring(parsedhead[11].from + offset, parsedhead[11].to + offset2).trim();
|
||||||
checkColumn(12);
|
checkColumn(12);
|
||||||
const fullcommand = line.substring(parsedhead[12].from + offset, parsedhead[12].to + offset2).trim().replace(/\[/g, '').replace(/]/g, '');
|
const fullcommand = line.substring(parsedhead[12].from + offset, parsedhead[12].to + offset2).trim().replace(/\[/g, '').replace(/]/g, '');
|
||||||
let path = '';
|
let cmdPath = '';
|
||||||
let command = '';
|
let command = '';
|
||||||
let params = '';
|
let params = '';
|
||||||
// try to figure out where parameter starts
|
// try to figure out where parameter starts
|
||||||
@ -485,14 +488,19 @@ function processes(callback) {
|
|||||||
const tmpParams = fullcommand.substr(firstPos);
|
const tmpParams = fullcommand.substr(firstPos);
|
||||||
const lastSlashPos = tmpCommand.lastIndexOf('/');
|
const lastSlashPos = tmpCommand.lastIndexOf('/');
|
||||||
if (lastSlashPos >= 0) {
|
if (lastSlashPos >= 0) {
|
||||||
path = tmpCommand.substr(0, lastSlashPos);
|
cmdPath = tmpCommand.substr(0, lastSlashPos);
|
||||||
tmpCommand = tmpCommand.substr(lastSlashPos + 1);
|
tmpCommand = tmpCommand.substr(lastSlashPos + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstPos === 10000) {
|
if (firstPos === 10000 && tmpCommand.indexOf(' ') > -1) {
|
||||||
const parts = tmpCommand.split(' ');
|
const parts = tmpCommand.split(' ');
|
||||||
command = parts.shift();
|
if (fs.existsSync(path.join(cmdPath, parts[0]))) {
|
||||||
params = (parts.join(' ') + ' ' + tmpParams).trim();
|
command = parts.shift();
|
||||||
|
params = (parts.join(' ') + ' ' + tmpParams).trim();
|
||||||
|
} else {
|
||||||
|
command = tmpCommand.trim();
|
||||||
|
params = tmpParams.trim();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
command = tmpCommand.trim();
|
command = tmpCommand.trim();
|
||||||
params = tmpParams.trim();
|
params = tmpParams.trim();
|
||||||
@ -516,7 +524,7 @@ function processes(callback) {
|
|||||||
user: user,
|
user: user,
|
||||||
command: command,
|
command: command,
|
||||||
params: params,
|
params: params,
|
||||||
path: path
|
path: cmdPath
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user