File tree Expand file tree Collapse file tree 1 file changed +3
-11
lines changed
Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ export class StdioClientTransport implements Transport {
192192 }
193193 }
194194
195- private async forceExitProcess ( pid : number ) : Promise < void > {
195+ private forceExitProcess ( pid : number ) : void {
196196 try {
197197 process . kill ( pid , "SIGKILL" ) ;
198198
@@ -206,18 +206,10 @@ export class StdioClientTransport implements Transport {
206206 }
207207 }
208208
209- private async gracefullyExitProcess ( pid : number ) : Promise < void > {
210- process . kill ( pid , "SIGINT" ) ;
211-
212- await new Promise < void > ( resolve => setTimeout ( ( ) => {
213- this . forceExitProcess ( pid ) ;
214- resolve ( ) ;
215- } , 3000 ) ) ;
216- }
217-
218209 async close ( ) : Promise < void > {
210+ const pid = this . pid ;
211+ this . _abortController . signal . onabort = ( ) => setTimeout ( ( ) => pid && this . forceExitProcess ( pid ) , 3000 ) ;
219212 this . _abortController . abort ( ) ;
220- this . gracefullyExitProcess ( this . pid ! ) ;
221213 this . _process = undefined ;
222214 this . _readBuffer . clear ( ) ;
223215 }
You can’t perform that action at this time.
0 commit comments