@@ -384,26 +384,28 @@ If you are trying to run on specific emulator, use tns run –device <DeviceID>.
384
384
await this . detectCurrentlyAttachedDevices ( ) ;
385
385
let deviceInstances = this . getDeviceInstances ( ) ;
386
386
387
- //if no --device is passed and no devices are found, the default emulator is started
388
- if ( data && data . platform && ! data . deviceId && _ . isEmpty ( deviceInstances ) ) {
389
- return await this . startEmulator ( data . platform ) ;
390
- }
387
+ if ( data && data . platform ) {
388
+ //if no --device is passed and no devices are found, the default emulator is started
389
+ if ( ! data . deviceId && _ . isEmpty ( deviceInstances ) ) {
390
+ return await this . startEmulator ( data . platform ) ;
391
+ }
391
392
392
- //check if --device(value) is running, if it's not or it's not the same as is specified, start with name from --device(value)
393
- if ( data && data . platform && data . deviceId ) {
394
- if ( ! helpers . isNumber ( data . deviceId ) ) {
395
- let activeDeviceInstance = _ . find ( this . getDeviceInstances ( ) , ( device : Mobile . IDevice ) => { return device . deviceInfo . identifier === data . deviceId ; } ) ;
396
- if ( ! activeDeviceInstance ) {
397
- return await this . startEmulator ( data . platform , data . deviceId ) ;
393
+ //check if --device(value) is running, if it's not or it's not the same as is specified, start with name from --device(value)
394
+ if ( data . deviceId ) {
395
+ if ( ! helpers . isNumber ( data . deviceId ) ) {
396
+ let activeDeviceInstance = _ . find ( this . getDeviceInstances ( ) , ( device : Mobile . IDevice ) => { return device . deviceInfo . identifier === data . deviceId ; } ) ;
397
+ if ( ! activeDeviceInstance ) {
398
+ return await this . startEmulator ( data . platform , data . deviceId ) ;
399
+ }
398
400
}
399
401
}
400
- }
401
402
402
- // if only emulator flag is passed and no other emulators are running, start default emulator
403
- if ( data && data . platform && data . emulator && deviceInstances . length ) {
404
- let runningDeviceInstance = _ . some ( deviceInstances , ( value ) => { return value . isEmulator ; } ) ;
405
- if ( ! runningDeviceInstance ) {
406
- return await this . startEmulator ( data . platform ) ;
403
+ // if only emulator flag is passed and no other emulators are running, start default emulator
404
+ if ( data . emulator && deviceInstances . length ) {
405
+ let runningDeviceInstance = _ . some ( deviceInstances , ( value ) => { return value . isEmulator ; } ) ;
406
+ if ( ! runningDeviceInstance ) {
407
+ return await this . startEmulator ( data . platform ) ;
408
+ }
407
409
}
408
410
}
409
411
}
0 commit comments