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 |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.21.20 | 2023-11-24 | `powerShell()` fix invalid pattern (windows) |
| 5.21.19 | 2023-12-03 | fix typescript typings |
| 5.21.18 | 2023-11-24 | `networkConnections()` fix truncated ip6 addr (macOS) |
| 5.21.17 | 2023-11-11 | `system()` Raspberry Pi 5 name fix |

View File

@ -57,6 +57,11 @@
</tr>
</thead>
<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>
<th scope="row">5.21.19</th>
<td>2023-12-03</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</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>
</div>
<div class="down">

View File

@ -423,10 +423,10 @@ function powerShellRelease() {
function powerShell(cmd) {
const pattern = [
'[\\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=><~]))'
].join('|');
/// const pattern = [
/// '[\\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=><~]))'
/// ].join('|');
if (_psPersistent) {
const id = Math.random().toString(36).substring(2, 12);
@ -472,7 +472,7 @@ function powerShell(cmd) {
}
if (child && child.pid) {
child.stdout.on('data', function (data) {
result = result + data.toString('utf8').replace(pattern, '');
result = result + data.toString('utf8');
});
child.stderr.on('data', function () {
child.kill();