Skip to content

Commit e0719c7

Browse files
committed
Fix process kill and reuse logic
1 parent 9225d20 commit e0719c7

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/debug-adapter/nativeScriptDebugAdapter.ts

+15-11
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,30 @@ export class NativeScriptDebugAdapter extends ChromeDebugAdapter {
1313
private _tnsProcess: ChildProcess;
1414

1515
public async attach(args: any): Promise<void> {
16-
const attachArgs = await this.processRequest(args);
17-
(this.pathTransformer as any).setTargetPlatform(args.platform);
18-
19-
return super.attach(attachArgs);
16+
return await this.processRequestAndAttach(args);
2017
}
2118

2219
public async launch(args: any, telemetryPropertyCollector?: ITelemetryPropertyCollector): Promise<void> {
23-
const launchArgs = await this.processRequest(args) as any;
24-
(this.pathTransformer as any).setTargetPlatform(args.platform);
25-
26-
return super.attach(launchArgs);
20+
return await this.processRequestAndAttach(args);
2721
}
2822

29-
public async disconnect(args: any) {
23+
public disconnect(args: any): void {
24+
super.disconnect(args);
25+
3026
if (this._tnsProcess) {
27+
this._tnsProcess.stdout.removeAllListeners();
28+
this._tnsProcess.stderr.removeAllListeners();
29+
this._tnsProcess.removeAllListeners();
3130
utils.killProcess(this._tnsProcess);
32-
this._tnsProcess = null;
3331
}
32+
}
3433

35-
super.disconnect(args);
34+
private async processRequestAndAttach(args: any) {
35+
const transformedArgs = await this.processRequest(args);
36+
(this.pathTransformer as any).setTargetPlatform(args.platform);
37+
(ChromeDebugAdapter as any).SET_BREAKPOINTS_TIMEOUT = 20000;
38+
39+
return super.attach(transformedArgs);
3640
}
3741

3842
private async processRequest(args: any) : Promise<any> {

0 commit comments

Comments
 (0)