paneful 0.8.5 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -26,11 +26,13 @@ export class PortMonitor {
|
|
|
26
26
|
// so scanning resumes automatically on restart.
|
|
27
27
|
if (info.ports.size > 0)
|
|
28
28
|
return;
|
|
29
|
-
//
|
|
30
|
-
const clean =
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
// Strip ANSI codes from just the new chunk, then append to line buffer
|
|
30
|
+
const clean = data.replace(ANSI_RE, '');
|
|
31
|
+
const combined = info.lineBuffer + clean;
|
|
32
|
+
const lines = combined.split(/\r?\n/);
|
|
33
|
+
// Keep last incomplete line in buffer, capped to prevent unbounded growth
|
|
34
|
+
const tail = lines.pop() ?? '';
|
|
35
|
+
info.lineBuffer = tail.length > 512 ? tail.slice(-512) : tail;
|
|
34
36
|
let found = false;
|
|
35
37
|
for (const line of lines) {
|
|
36
38
|
PORT_RE.lastIndex = 0;
|