Permalink
Browse files

Update runAndroid.js to fix startServerInNewWindow() (Windows)

Summary:
**Motivation**
Resolves issue: #12367. The issue is that the packager does not launch automatically on Windows when running `react-native run-android` like it does on OSX. The proposed change fixes this issue, and causes the packager to be launched automatically on Windows 10. Also note the updated code uses the syntax described in the [Node.js documentation](https://nodejs.org/api/all.html#child_process_spawning_bat_and_cmd_files_on_windows) on spawning .bat files on Windows.

**Test plan**
Manually tested on Windows 10.

Running just `react-native run-android` now results in the packager launching, without needing to run `react-native start` in a new command prompt window.

**Screenshot:**
![packager](https://cloud.githubusercontent.com/assets/17132071/23641540/8d82bb7c-02c2-11e7-9c47-d1c9b582bd65.png)
Closes #12755

Differential Revision: D4767321

fbshipit-source-id: a14f369ba99939aa44d0ee3403e1d262e2657e6e
  • Loading branch information...
jrodiger authored and facebook-github-bot committed Mar 24, 2017
1 parent 9a88c72 commit f891985bd853f1732c6d77ee02e5d019190ef04b
Showing with 1 addition and 1 deletion.
  1. +1 −1 local-cli/runAndroid/runAndroid.js
@@ -265,7 +265,7 @@ function startServerInNewWindow() {
} else if (/^win/.test(process.platform)) {
procConfig.detached = true;
procConfig.stdio = 'ignore';
return child_process.spawn('cmd.exe', ['/C', 'start', launchPackagerScript], procConfig);
return child_process.spawn('cmd.exe', ['/C', launchPackagerScript], procConfig);
} else {
console.log(chalk.red(`Cannot start the packager. Unknown platform ${process.platform}`));
}

0 comments on commit f891985

Please sign in to comment.