Skip to content

Commit f6bc3e2

Browse files
committed
Fixes
1 parent 1b62fc6 commit f6bc3e2

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/debug-adapter/nativeScriptDebugAdapter.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export function nativeScriptDebugAdapterGenerator(iosProject: typeof IosProject,
1616
private _pendingRequests: object = {};
1717
private isLiveSync: boolean = false;
1818
private portWaitingResolve: any;
19+
private isDisconnecting: boolean = false;
1920

2021
public attach(args: any): Promise<void> {
2122
return this.processRequestAndAttach(args);
@@ -25,14 +26,6 @@ export function nativeScriptDebugAdapterGenerator(iosProject: typeof IosProject,
2526
return this.processRequestAndAttach(args);
2627
}
2728

28-
public disconnect(args: any): void {
29-
super.disconnect(args);
30-
31-
if (!args.restart) {
32-
this.callRemoteMethod('buildService', 'disconnect');
33-
}
34-
}
35-
3629
public onPortReceived(port) {
3730
this.portWaitingResolve && this.portWaitingResolve(port);
3831
}
@@ -42,13 +35,22 @@ export function nativeScriptDebugAdapterGenerator(iosProject: typeof IosProject,
4235
delete this._pendingRequests[response.requestId];
4336
}
4437

38+
public disconnect(args: any): void {
39+
this.isDisconnecting = true;
40+
if (!args.restart) {
41+
this.callRemoteMethod('buildService', 'disconnect');
42+
}
43+
44+
super.disconnect(args);
45+
}
46+
4547
protected async terminateSession(reason: string, disconnectArgs?: DebugProtocol.DisconnectArguments, restart?: IRestartRequestArgs): Promise<void> {
4648
let restartRequestArgs;
4749
let timeoutId;
4850

49-
if (this.isLiveSync) {
51+
if (!this.isDisconnecting && this.isLiveSync) {
5052
const portProm = new Promise<any>((res, rej) => {
51-
this. portWaitingResolve = res;
53+
this.portWaitingResolve = res;
5254

5355
timeoutId = setTimeout(() => {
5456
res();

0 commit comments

Comments
 (0)