Skip to content

Commit

Permalink
Reject deferred on dispose
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj committed Jul 17, 2023
1 parent f531b28 commit 7eceaa3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/client/common/process/rawProcessApis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export function plainExec(
dispose: () => {
if (!proc.killed) {
proc.kill();
deferred.reject(new Error('Process was killed'));
}
},
};
Expand Down
6 changes: 6 additions & 0 deletions src/client/common/utils/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,17 @@ class DeferredImpl<T> implements Deferred<T> {
}

public resolve(_value: T | PromiseLike<T>) {
if (this.completed) {
return;
}
this._resolve.apply(this.scope ? this.scope : this, [_value]);
this._resolved = true;
}

public reject(_reason?: string | Error | Record<string, unknown>) {
if (this.completed) {
return;
}
this._reject.apply(this.scope ? this.scope : this, [_reason]);
this._rejected = true;
}
Expand Down

0 comments on commit 7eceaa3

Please sign in to comment.