@@ -5,6 +5,7 @@ import * as semver from "semver";
55import * as xcode from "xcode" ;
66import * as constants from "../constants" ;
77import * as helpers from "../common/helpers" ;
8+ import { attachAwaitDetach } from "../common/helpers" ;
89import * as projectServiceBaseLib from "./platform-project-service-base" ;
910import { PlistSession } from "plist-merge-patch" ;
1011import { EOL } from "os" ;
@@ -180,7 +181,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
180181 let projectRoot = this . getPlatformData ( projectData ) . projectRoot ;
181182 let archivePath = options && options . archivePath ? path . resolve ( options . archivePath ) : path . join ( projectRoot , "/build/archive/" , projectData . projectName + ".xcarchive" ) ;
182183 let args = [ "archive" , "-archivePath" , archivePath , "-configuration" ,
183- ( ! buildConfig || buildConfig . release ) ? "Release" : "Debug" ]
184+ ( ! buildConfig || buildConfig . release ) ? "Release" : "Debug" ]
184185 . concat ( this . xcbuildProjectArgs ( projectRoot , projectData , "scheme" ) ) ;
185186 await this . $childProcess . spawnFromEvent ( "xcodebuild" , args , "exit" , { stdio : 'inherit' } ) ;
186187 return archivePath ;
@@ -287,15 +288,21 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
287288 // }
288289 // }
289290
290- this . $childProcess . on ( constants . BUILD_OUTPUT_EVENT_NAME , ( data : any ) => {
291+ const handler = ( data : any ) => {
291292 this . emit ( constants . BUILD_OUTPUT_EVENT_NAME , data ) ;
292- } ) ;
293+ } ;
294+
293295 if ( buildConfig . buildForDevice ) {
294- await this . buildForDevice ( projectRoot , basicArgs , buildConfig , projectData ) ;
296+ await attachAwaitDetach ( constants . BUILD_OUTPUT_EVENT_NAME ,
297+ this . $childProcess ,
298+ handler ,
299+ this . buildForDevice ( projectRoot , basicArgs , buildConfig , projectData ) ) ;
295300 } else {
296- await this . buildForSimulator ( projectRoot , basicArgs , projectData , buildConfig . buildOutputStdio ) ;
301+ await attachAwaitDetach ( constants . BUILD_OUTPUT_EVENT_NAME ,
302+ this . $childProcess ,
303+ handler ,
304+ this . buildForSimulator ( projectRoot , basicArgs , projectData , buildConfig . buildOutputStdio ) ) ;
297305 }
298-
299306 }
300307
301308 public async validatePlugins ( projectData : IProjectData ) : Promise < void > {
0 commit comments