This repository was archived by the owner on Dec 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,10 @@ export class CloudDeviceEmulatorWrapper implements ICloudDeviceEmulator {
5
5
return this . cloudDeviceEmulatorInstance . deviceEmitter ;
6
6
}
7
7
8
- constructor ( ) {
8
+ constructor ( private $options : IOptions ,
9
+ private $processService : IProcessService ) {
9
10
this . cloudDeviceEmulatorInstance = require ( "cloud-device-emulator" ) ;
11
+ this . $processService . attachToProcessExitSignals ( this , this . _dispose ) ;
10
12
}
11
13
12
14
public getSeverAddress ( ) : Promise < ICloudDeviceServerInfo > {
@@ -20,6 +22,16 @@ export class CloudDeviceEmulatorWrapper implements ICloudDeviceEmulator {
20
22
public killServer ( ) : Promise < any > {
21
23
return this . cloudDeviceEmulatorInstance . killServer ( ) ;
22
24
}
25
+
26
+ public dispose ( ) {
27
+ if ( ! this . $options . watch ) {
28
+ this . _dispose ( ) ;
29
+ }
30
+ }
31
+
32
+ private _dispose ( ) {
33
+ this . cloudDeviceEmulatorInstance . deviceEmitter . dispose ( ) ;
34
+ }
23
35
}
24
36
25
37
$injector . register ( "cloudDeviceEmulator" , CloudDeviceEmulatorWrapper ) ;
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ interface IAppetizeEmulatorLauncher {
32
32
/**
33
33
* Describes service for interaction with server which communicates with cloud emulators.
34
34
*/
35
- interface ICloudDeviceEmulator {
35
+ interface ICloudDeviceEmulator extends IDisposable {
36
36
/**
37
37
* Event emitter instance that raises events upon finding/losing a device.
38
38
*/
Original file line number Diff line number Diff line change 45
45
"typescript" : " 2.1.5"
46
46
},
47
47
"dependencies" : {
48
- "cloud-device-emulator" : " ~0.2 .0" ,
48
+ "cloud-device-emulator" : " 0.3 .0" ,
49
49
"cookie" : " 0.3.1" ,
50
50
"lodash" : " 4.17.4" ,
51
51
"minimatch" : " 3.0.4" ,
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ class CustomDeviceEmitter extends EventEmitter implements CloudDeviceEmitter {
14
14
public getCurrentlyAttachedDevices ( ) : IAttachedDevices {
15
15
return this . _initialDevices ;
16
16
}
17
+ public dispose ( ) : void { /* empty */ }
17
18
}
18
19
19
20
describe ( "appetize device discovery" , ( ) => {
You can’t perform that action at this time.
0 commit comments