diff --git a/packages/cli-plugin-metro/src/commands/start/watchMode.ts b/packages/cli-plugin-metro/src/commands/start/watchMode.ts index e0f2e6e1b..3f2e3b280 100644 --- a/packages/cli-plugin-metro/src/commands/start/watchMode.ts +++ b/packages/cli-plugin-metro/src/commands/start/watchMode.ts @@ -41,6 +41,10 @@ function enableWatchMode(messageSocket: any, ctx: Config) { } }); + const execaOptions = { + env: {FORCE_COLOR: chalk.supportsColor ? 'true' : 'false'}, + }; + const onPress = (key: string) => { switch (key) { case 'r': @@ -53,19 +57,27 @@ function enableWatchMode(messageSocket: any, ctx: Config) { break; case 'i': logger.info('Opening app on iOS...'); - execa('npx', [ - 'react-native', - 'run-ios', - ...(ctx.project.ios?.watchModeCommandParams ?? []), - ]).stdout?.pipe(process.stdout); + execa( + 'npx', + [ + 'react-native', + 'run-ios', + ...(ctx.project.ios?.watchModeCommandParams ?? []), + ], + execaOptions, + ).stdout?.pipe(process.stdout); break; case 'a': logger.info('Opening app on Android...'); - execa('npx', [ - 'react-native', - 'run-android', - ...(ctx.project.android?.watchModeCommandParams ?? []), - ]).stdout?.pipe(process.stdout); + execa( + 'npx', + [ + 'react-native', + 'run-android', + ...(ctx.project.android?.watchModeCommandParams ?? []), + ], + execaOptions, + ).stdout?.pipe(process.stdout); break; case CTRL_Z: process.emit('SIGTSTP', 'SIGTSTP');