powerShell() fix invalid pattern

This commit is contained in:
Sebastian Hildebrandt 2023-12-03 19:48:04 +01:00
parent ad45f9b547
commit f4f9acd1c7
4 changed files with 12 additions and 6 deletions

View File

@ -83,6 +83,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment | | Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- | | ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.21.20 | 2023-11-24 | `powerShell()` fix invalid pattern (windows) |
| 5.21.19 | 2023-12-03 | fix typescript typings | | 5.21.19 | 2023-12-03 | fix typescript typings |
| 5.21.18 | 2023-11-24 | `networkConnections()` fix truncated ip6 addr (macOS) | | 5.21.18 | 2023-11-24 | `networkConnections()` fix truncated ip6 addr (macOS) |
| 5.21.17 | 2023-11-11 | `system()` Raspberry Pi 5 name fix | | 5.21.17 | 2023-11-11 | `system()` Raspberry Pi 5 name fix |

View File

@ -57,6 +57,11 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th scope="row">5.21.20</th>
<td>2023-12-03</td>
<td><span class="code">powerShell()</span> fix invalid pattern (windows)</td>
</tr>
<tr> <tr>
<th scope="row">5.21.19</th> <th scope="row">5.21.19</th>
<td>2023-12-03</td> <td>2023-12-03</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png" alt="logo"> <img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</div> <div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div> <div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.21.19</span></div> <div class="version">New Version: <span id="version">5.21.20</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">

View File

@ -423,10 +423,10 @@ function powerShellRelease() {
function powerShell(cmd) { function powerShell(cmd) {
const pattern = [ /// const pattern = [
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', /// '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))' /// '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))'
].join('|'); /// ].join('|');
if (_psPersistent) { if (_psPersistent) {
const id = Math.random().toString(36).substring(2, 12); const id = Math.random().toString(36).substring(2, 12);
@ -472,7 +472,7 @@ function powerShell(cmd) {
} }
if (child && child.pid) { if (child && child.pid) {
child.stdout.on('data', function (data) { child.stdout.on('data', function (data) {
result = result + data.toString('utf8').replace(pattern, ''); result = result + data.toString('utf8');
}); });
child.stderr.on('data', function () { child.stderr.on('data', function () {
child.kill(); child.kill();