@oh-my-pi/pi-utils 6.8.3 → 6.8.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/ptree.ts +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-utils",
3
- "version": "6.8.3",
3
+ "version": "6.8.4",
4
4
  "description": "Shared utilities for pi packages",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/ptree.ts CHANGED
@@ -142,7 +142,7 @@ export class ChildProcess {
142
142
  #stderrStream?: ReadableStream<Uint8Array>;
143
143
  #exitReason?: Exception;
144
144
  #exitReasonPending?: Exception;
145
- #exited: Promise<void>;
145
+ #exited: Promise<number>;
146
146
  #resolveExited: (ex?: PromiseLike<Exception> | Exception) => void;
147
147
 
148
148
  constructor(proc: PipedSubprocess) {
@@ -221,7 +221,7 @@ export class ChildProcess {
221
221
  const { promise, resolve } = Promise.withResolvers<Exception | undefined>();
222
222
 
223
223
  this.#exited = promise.then((ex?: Exception) => {
224
- if (!ex) return; // success, no exception
224
+ if (!ex) return proc.exitCode ?? -1337; // success, no exception
225
225
  if (proc.killed && this.#exitReasonPending) {
226
226
  ex = this.#exitReasonPending; // propagate reason if killed
227
227
  }
@@ -245,7 +245,7 @@ export class ChildProcess {
245
245
  get pid(): number | undefined {
246
246
  return this.#proc.pid;
247
247
  }
248
- get exited(): Promise<void> {
248
+ get exited(): Promise<number> {
249
249
  return this.#exited;
250
250
  }
251
251
  get exitCode(): number | null {