From aceaadd7ddbae6331b157b17c826caea7fbebef4 Mon Sep 17 00:00:00 2001 From: Emily Xiong Date: Mon, 26 Sep 2022 09:07:10 -0400 Subject: [PATCH] bugfix(react-native): fix pod install hanging when generate a new app (#12217) --- .../src/utils/pod-install-task.ts | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/packages/react-native/src/utils/pod-install-task.ts b/packages/react-native/src/utils/pod-install-task.ts index fc8f6c3d94..1774f7ca8e 100644 --- a/packages/react-native/src/utils/pod-install-task.ts +++ b/packages/react-native/src/utils/pod-install-task.ts @@ -1,4 +1,4 @@ -import { spawn } from 'child_process'; +import { execSync } from 'child_process'; import { platform } from 'os'; import * as chalk from 'chalk'; import { GeneratorCallback, logger } from '@nrwl/devkit'; @@ -42,21 +42,14 @@ export function runPodInstall( export function podInstall(iosDirectory: string): Promise { return new Promise((resolve, reject) => { - const process = spawn('pod', ['install'], { + const result = execSync('pod install', { cwd: iosDirectory, - stdio: [0, 1, 2], }); - - process.on('close', (code: number) => { - if (code === 0) { - resolve(); - } else { - reject(new Error(podInstallErrorMessage)); - } - }); - - process.on('error', () => { + logger.info(result.toString); + if (result.toString().includes('Pod installation complete')) { + resolve(); + } else { reject(new Error(podInstallErrorMessage)); - }); + } }); }