bugfix(react-native): fix pod install hanging when generate a new app (#12217)

This commit is contained in:
Emily Xiong 2022-09-26 09:07:10 -04:00 committed by GitHub
parent 2436a5d542
commit aceaadd7dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<void> {
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));
});
}
});
}