@@ -15,9 +15,11 @@ export class AndroidDeviceSocketsLiveSyncService extends DeviceLiveSyncServiceBa
15
15
protected $staticConfig : Config . IStaticConfig ,
16
16
private $logger : ILogger ,
17
17
protected device : Mobile . IAndroidDevice ,
18
- private $options : ICommonOptions ) {
18
+ private $options : ICommonOptions ,
19
+ private $processService : IProcessService ) {
19
20
super ( $platformsData , device ) ;
20
21
this . livesyncTool = this . $injector . resolve ( AndroidLivesyncTool ) ;
22
+ this . $processService . attachToProcessExitSignals ( this . livesyncTool , this . livesyncTool . end ) ;
21
23
}
22
24
23
25
public async beforeLiveSyncAction ( deviceAppData : Mobile . IDeviceAppData ) : Promise < void > {
@@ -35,7 +37,6 @@ export class AndroidDeviceSocketsLiveSyncService extends DeviceLiveSyncServiceBa
35
37
const operationIdentifier = this . livesyncTool . generateOperationIdentifier ( ) ;
36
38
const doSyncPromise = this . livesyncTool . sendDoSyncOperation ( operationIdentifier ) ;
37
39
38
- //TODO clear interval on exit sygnals/stopLivesync
39
40
const syncInterval : NodeJS . Timer = setInterval ( ( ) => {
40
41
if ( this . livesyncTool . isOperationInProgress ( operationIdentifier ) ) {
41
42
this . $logger . info ( "Sync operation in progress..." ) ;
@@ -45,7 +46,10 @@ export class AndroidDeviceSocketsLiveSyncService extends DeviceLiveSyncServiceBa
45
46
const clearSyncInterval = ( ) => {
46
47
clearInterval ( syncInterval ) ;
47
48
} ;
49
+
50
+ this . $processService . attachToProcessExitSignals ( this , clearSyncInterval ) ;
48
51
doSyncPromise . then ( clearSyncInterval , clearSyncInterval ) ;
52
+
49
53
await doSyncPromise ;
50
54
51
55
if ( ! canExecuteFastSync ) {
0 commit comments