File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed
Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change 11///<reference path="../.d.ts"/>
22"use strict" ;
33
4+ import * as child_process from "child_process" ;
45import * as path from "path" ;
56import * as shell from "shelljs" ;
67import * as constants from "../constants" ;
@@ -482,8 +483,28 @@ export class PlatformService implements IPlatformService {
482483 }
483484
484485 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+ }
487508 }
488509
489510 public validatePlatform ( platform : string ) : void {
You can’t perform that action at this time.
0 commit comments