@oh-my-pi/pi-utils 9.1.0 → 9.2.0
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.
- package/package.json +2 -3
- package/src/ptree.ts +6 -0
- package/src/stream.ts +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-utils",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"description": "Shared utilities for pi packages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"winston": "^3.19.0",
|
|
31
|
-
"winston-daily-rotate-file": "^5.0.0"
|
|
32
|
-
"strip-ansi": "^7.1.2"
|
|
31
|
+
"winston-daily-rotate-file": "^5.0.0"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@types/node": "^25.0.10"
|
package/src/ptree.ts
CHANGED
|
@@ -251,6 +251,9 @@ export class ChildProcess<In extends InMask = InMask> {
|
|
|
251
251
|
proc.exited
|
|
252
252
|
.catch(() => null)
|
|
253
253
|
.then(async exitCode => {
|
|
254
|
+
// Stop pumping streams - process has exited, no more data coming
|
|
255
|
+
this.#stop.abort();
|
|
256
|
+
|
|
254
257
|
if (this.#exitReasonPending) {
|
|
255
258
|
this.#exitReason = this.#exitReasonPending;
|
|
256
259
|
reject(this.#exitReasonPending);
|
|
@@ -411,6 +414,9 @@ export class ChildProcess<In extends InMask = InMask> {
|
|
|
411
414
|
}
|
|
412
415
|
|
|
413
416
|
[Symbol.dispose](): void {
|
|
417
|
+
// Don't kill if process already exited - avoids race where dispose runs
|
|
418
|
+
// before the proc.exited.then() callback, causing spurious AbortError
|
|
419
|
+
if (this.proc.exitCode !== null) return;
|
|
414
420
|
this.kill(new AbortError("process disposed", this.#stderrBuffer));
|
|
415
421
|
}
|
|
416
422
|
}
|
package/src/stream.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { TextDecoderStream } from "node:stream/web";
|
|
2
|
-
import stripAnsi from "strip-ansi";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Sanitize binary output for display/storage.
|
|
@@ -40,7 +39,7 @@ export function sanitizeBinaryOutput(str: string): string {
|
|
|
40
39
|
* Sanitize text output: strip ANSI codes, remove binary garbage, normalize line endings.
|
|
41
40
|
*/
|
|
42
41
|
export function sanitizeText(text: string): string {
|
|
43
|
-
return sanitizeBinaryOutput(
|
|
42
|
+
return sanitizeBinaryOutput(Bun.stripANSI(text)).replace(/\r/g, "");
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
/**
|