@oh-my-pi/pi-utils 9.1.1 → 9.2.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-utils",
3
- "version": "9.1.1",
3
+ "version": "9.2.1",
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/procmgr.ts CHANGED
@@ -294,6 +294,7 @@ export async function terminate(options: TerminateOptions): Promise<boolean> {
294
294
  stdout: "ignore",
295
295
  stderr: "ignore",
296
296
  timeout: 5000,
297
+ windowsHide: true,
297
298
  });
298
299
  void taskkill.exited.catch(() => {});
299
300
  taskkill.unref();
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
  }
@@ -441,6 +447,7 @@ export function spawn<In extends InMask = InMask>(cmd: string[], options?: Child
441
447
  stdout: "pipe",
442
448
  stderr: "pipe",
443
449
  detached,
450
+ windowsHide: true,
444
451
  ...rest,
445
452
  });
446
453
  const cproc = new ChildProcess(child, detached);
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(stripAnsi(text)).replace(/\r/g, "");
42
+ return sanitizeBinaryOutput(Bun.stripANSI(text)).replace(/\r/g, "");
44
43
  }
45
44
 
46
45
  /**