@@ -192,7 +192,7 @@ const assertIosToolchain = ({ dryRun }) => {
192192 } ) ;
193193} ;
194194
195- const run = ( { args, command, cwd, dryRun } ) => {
195+ const run = ( { args, captureOutput = false , command, cwd, dryRun } ) => {
196196 const relativeCwd = path . relative ( repoRoot , cwd ) || "." ;
197197 process . stdout . write (
198198 `$ cd ${ relativeCwd } && ${ commandText ( command , args ) } \n`
@@ -205,24 +205,29 @@ const run = ({ args, command, cwd, dryRun }) => {
205205 const result = spawnSync ( command , args , {
206206 cwd,
207207 encoding : "utf8" ,
208- stdio : [ "inherit" , "pipe" , "pipe" ]
208+ maxBuffer : captureOutput ? 1024 * 1024 * 20 : undefined ,
209+ stdio : captureOutput ? [ "inherit" , "pipe" , "pipe" ] : "inherit"
209210 } ) ;
210211
211- if ( result . stdout ) {
212+ if ( captureOutput && result . stdout ) {
212213 process . stdout . write ( result . stdout ) ;
213214 }
214215
215- if ( result . stderr ) {
216+ if ( captureOutput && result . stderr ) {
216217 process . stderr . write ( result . stderr ) ;
217218 }
218219
220+ if ( result . error ) {
221+ throw result . error ;
222+ }
223+
219224 if ( result . status !== 0 ) {
220225 throw new Error (
221226 `${ commandText ( command , args ) } failed with exit code ${ result . status ?? 1 } `
222227 ) ;
223228 }
224229
225- return result . stdout ?? "" ;
230+ return captureOutput ? ( result . stdout ?? "" ) : "" ;
226231} ;
227232
228233const runExpoPrebuild = ( { appDir, dryRun, platform } ) => {
@@ -342,6 +347,7 @@ const discoverIosScheme = ({ appDir, dryRun, iosDir, xcodeTargetArgs }) => {
342347
343348 const output = run ( {
344349 args : [ "-list" , "-json" , ...xcodeTargetArgs ] ,
350+ captureOutput : true ,
345351 command : "xcodebuild" ,
346352 cwd : iosDir ,
347353 dryRun : false
0 commit comments