@@ -5,6 +5,7 @@ import * as semver from "semver";
5
5
import * as xcode from "xcode" ;
6
6
import * as constants from "../constants" ;
7
7
import * as helpers from "../common/helpers" ;
8
+ import { attachAwaitDetach } from "../common/helpers" ;
8
9
import * as projectServiceBaseLib from "./platform-project-service-base" ;
9
10
import { PlistSession } from "plist-merge-patch" ;
10
11
import { EOL } from "os" ;
@@ -180,7 +181,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
180
181
let projectRoot = this . getPlatformData ( projectData ) . projectRoot ;
181
182
let archivePath = options && options . archivePath ? path . resolve ( options . archivePath ) : path . join ( projectRoot , "/build/archive/" , projectData . projectName + ".xcarchive" ) ;
182
183
let args = [ "archive" , "-archivePath" , archivePath , "-configuration" ,
183
- ( ! buildConfig || buildConfig . release ) ? "Release" : "Debug" ]
184
+ ( ! buildConfig || buildConfig . release ) ? "Release" : "Debug" ]
184
185
. concat ( this . xcbuildProjectArgs ( projectRoot , projectData , "scheme" ) ) ;
185
186
await this . $childProcess . spawnFromEvent ( "xcodebuild" , args , "exit" , { stdio : 'inherit' } ) ;
186
187
return archivePath ;
@@ -287,15 +288,21 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
287
288
// }
288
289
// }
289
290
290
- this . $childProcess . on ( constants . BUILD_OUTPUT_EVENT_NAME , ( data : any ) => {
291
+ const handler = ( data : any ) => {
291
292
this . emit ( constants . BUILD_OUTPUT_EVENT_NAME , data ) ;
292
- } ) ;
293
+ } ;
294
+
293
295
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 ) ) ;
295
300
} 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 ) ) ;
297
305
}
298
-
299
306
}
300
307
301
308
public async validatePlugins ( projectData : IProjectData ) : Promise < void > {
0 commit comments