Commit 9bcedad

Anton Medvedev <anton@medv.io>
2022-06-09 22:28:14
Add missing then() method
1 parent 932c668
Changed files (1)
src/core.ts
@@ -217,6 +217,20 @@ export class ProcessPromise extends Promise<ProcessOutput> {
     }
   }
 
+  then<T = ProcessOutput, E = ProcessOutput>(
+    onfulfilled?:
+      | ((value: ProcessOutput) => PromiseLike<T> | T)
+      | undefined
+      | null,
+    onrejected?:
+      | ((reason: ProcessOutput) => PromiseLike<E> | E)
+      | undefined
+      | null
+  ): Promise<T | E> {
+    this._run()
+    return super.then(onfulfilled, onrejected)
+  }
+
   get stdin(): Writable {
     this.stdio('pipe')
     this._run()