Skip to content

Commit a36eefc

Browse files
aajahidAbdullah Al Jahid
andauthored
Fix for run-android on windows. (#2236)
* Fix for `run-android` on windows. * Comment added explaining why awaiting is not used --------- Co-authored-by: Abdullah Al Jahid <[email protected]>
1 parent 933f6cf commit a36eefc

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

packages/cli-platform-android/src/commands/runAndroid/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ async function runAndroid(_argv: Array<string>, config: Config, args: Flags) {
6161
);
6262

6363
if (startPackager) {
64-
await startServerInNewWindow(
64+
// Awaiting this causes the CLI to hang indefinitely, so this must execute without await.
65+
startServerInNewWindow(
6566
newPort,
6667
config.root,
6768
config.reactNativePath,

packages/cli-tools/src/getDefaultUserTerminal.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ const getDefaultUserTerminal = (): string | undefined => {
1111
return TERM_PROGRAM;
1212
}
1313

14+
if (os.platform() === 'win32') {
15+
return 'cmd.exe';
16+
}
17+
1418
return TERM;
1519
};
1620

packages/cli-tools/src/startServerInNewWindow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function startServerInNewWindow(
103103
}
104104
if (isWindows) {
105105
// Awaiting this causes the CLI to hang indefinitely, so this must execute without await.
106-
return execa('cmd.exe', ['/C', launchPackagerScript], {
106+
return execa(terminal, ['/C', launchPackagerScript], {
107107
...procConfig,
108108
detached: true,
109109
stdio: 'ignore',

0 commit comments

Comments
 (0)