@@ -192,6 +192,25 @@ export const $: Shell & Options = new Proxy<Shell & Options>(
192
192
193
193
type Resolve = ( out : ProcessOutput ) = > void
194
194
195
+ export interface ProcessPromise extends Promise < ProcessOutput > {
196
+ then < R = ProcessOutput , E = ProcessOutput > (
197
+ onfulfilled ?:
198
+ | ( ( value : ProcessOutput ) => PromiseLike < R > | R )
199
+ | undefined
200
+ | null ,
201
+ onrejected ?:
202
+ | ( ( reason : ProcessOutput ) => PromiseLike < E > | E )
203
+ | undefined
204
+ | null
205
+ ) : Promise < R | E >
206
+ catch < T = ProcessOutput > (
207
+ onrejected ?:
208
+ | ( ( reason : ProcessOutput ) => PromiseLike < T > | T )
209
+ | undefined
210
+ | null
211
+ ) : Promise < ProcessOutput | T >
212
+ }
213
+
195
214
export class ProcessPromise extends Promise < ProcessOutput > {
196
215
private _command = ''
197
216
private _from = ''
@@ -520,32 +539,6 @@ export class ProcessPromise extends Promise<ProcessOutput> {
520
539
return this . _nothrow ?? this . _snapshot . nothrow
521
540
}
522
541
523
- // Promise API
524
- then < R = ProcessOutput , E = ProcessOutput > (
525
- onfulfilled ?:
526
- | ( ( value : ProcessOutput ) => PromiseLike < R > | R )
527
- | undefined
528
- | null ,
529
- onrejected ?:
530
- | ( ( reason : ProcessOutput ) => PromiseLike < E > | E )
531
- | undefined
532
- | null
533
- ) : Promise < R | E > {
534
- if ( this . isHalted ( ) && ! this . child ) {
535
- throw new Error ( 'The process is halted!' )
536
- }
537
- return super . then ( onfulfilled , onrejected )
538
- }
539
-
540
- catch < T = ProcessOutput > (
541
- onrejected ?:
542
- | ( ( reason : ProcessOutput ) => PromiseLike < T > | T )
543
- | undefined
544
- | null
545
- ) : Promise < ProcessOutput | T > {
546
- return super . catch ( onrejected )
547
- }
548
-
549
542
// Stream-like API
550
543
private writable = true
551
544
private emit ( event : string , ...args : any [ ] ) {
0 commit comments