@@ -16,6 +16,7 @@ export function nativeScriptDebugAdapterGenerator(iosProject: typeof IosProject,
16
16
private _pendingRequests : object = { } ;
17
17
private isLiveSync : boolean = false ;
18
18
private portWaitingResolve : any ;
19
+ private isDisconnecting : boolean = false ;
19
20
20
21
public attach ( args : any ) : Promise < void > {
21
22
return this . processRequestAndAttach ( args ) ;
@@ -25,14 +26,6 @@ export function nativeScriptDebugAdapterGenerator(iosProject: typeof IosProject,
25
26
return this . processRequestAndAttach ( args ) ;
26
27
}
27
28
28
- public disconnect ( args : any ) : void {
29
- super . disconnect ( args ) ;
30
-
31
- if ( ! args . restart ) {
32
- this . callRemoteMethod ( 'buildService' , 'disconnect' ) ;
33
- }
34
- }
35
-
36
29
public onPortReceived ( port ) {
37
30
this . portWaitingResolve && this . portWaitingResolve ( port ) ;
38
31
}
@@ -42,13 +35,22 @@ export function nativeScriptDebugAdapterGenerator(iosProject: typeof IosProject,
42
35
delete this . _pendingRequests [ response . requestId ] ;
43
36
}
44
37
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
+
45
47
protected async terminateSession ( reason : string , disconnectArgs ?: DebugProtocol . DisconnectArguments , restart ?: IRestartRequestArgs ) : Promise < void > {
46
48
let restartRequestArgs ;
47
49
let timeoutId ;
48
50
49
- if ( this . isLiveSync ) {
51
+ if ( ! this . isDisconnecting && this . isLiveSync ) {
50
52
const portProm = new Promise < any > ( ( res , rej ) => {
51
- this . portWaitingResolve = res ;
53
+ this . portWaitingResolve = res ;
52
54
53
55
timeoutId = setTimeout ( ( ) => {
54
56
res ( ) ;
0 commit comments