File tree 1 file changed +23
-2
lines changed
1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change 1
1
///<reference path="../.d.ts"/>
2
2
"use strict" ;
3
3
4
+ import * as child_process from "child_process" ;
4
5
import * as path from "path" ;
5
6
import * as shell from "shelljs" ;
6
7
import * as constants from "../constants" ;
@@ -482,8 +483,28 @@ export class PlatformService implements IPlatformService {
482
483
}
483
484
484
485
public deployOnEmulator ( platform : string , buildConfig ?: IBuildConfig ) : IFuture < void > {
485
- this . $options . emulator = true ;
486
- return this . deployOnDevice ( platform , buildConfig ) ;
486
+ platform = platform . toLowerCase ( ) ;
487
+
488
+ if ( this . $options . availableDevices ) {
489
+ return ( ( ) => {
490
+ let callback = ( error : Error , stdout : Buffer , stderr : Buffer ) => {
491
+ if ( error !== null ) {
492
+ this . $errors . fail ( error ) ;
493
+ } else {
494
+ this . $logger . info ( stdout ) ;
495
+ }
496
+ } ;
497
+
498
+ if ( this . $mobileHelper . isiOSPlatform ( platform ) ) {
499
+ child_process . exec ( "instruments -s devices" , callback ) ;
500
+ } else if ( this . $mobileHelper . isAndroidPlatform ( platform ) ) {
501
+ child_process . exec ( "android list avd" , callback ) ;
502
+ }
503
+ } ) . future < void > ( ) ( ) ;
504
+ } else {
505
+ this . $options . emulator = true ;
506
+ return this . deployOnDevice ( platform , buildConfig ) ;
507
+ }
487
508
}
488
509
489
510
public validatePlatform ( platform : string ) : void {
You can’t perform that action at this time.
0 commit comments