Skip to content

Commit 79e498b

Browse files
smvvfacebook-github-bot
authored andcommitted
Allow packager to be opened in specific terminal on Linux and Mac OS X
Summary: Thanks for submitting a PR! Please read these instructions carefully: - [ ] Explain the **motivation** for making this change. - [ ] Provide a **test plan** demonstrating that the code is solid. - [ ] Match the **code formatting** of the rest of the codebase. - [ ] Target the `master` branch, NOT a "stable" branch. What existing problem does the pull request solve? Currently, it is not possible to spawn the packager in a specific terminal on Linux and Mac OS X. For example, after applying this patch, starting the packager in a new xfce terminal on Linux can be done using: react-native run-android --terminal /usr/bin/xfce4-terminal When the command is ran a second time, and the terminal is still running, the command will not spawn a new terminal for the packager. The option 'open' is renamed to 'terminal' for consistency. Note that the option 'open' was never exposed to the CLI though. A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI or updates the website. See [What is a Test Plan?][1] to learn more. If you have added code that should be tested, add tests. See command above. Sign the [CLA][2], if you haven't already. Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it. Make sure all **tests pass** on both [Travis][3] and [Circle CI][4]. PRs that break tests are unlikely to be merged. For more info, see the ["Pull Requests"][5] section of our "Contributing" guidelines. [1]: https://medium.com/martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9 [2]: https://code.facebook.com/cla [3]: https://travis-ci.org/facebook/react-native [4]: http://circleci.com/gh/facebook/react-native [5]: https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests Closes facebook#13065 Differential Revision: D5700713 Pulled By: hramos fbshipit-source-id: d9729a484c0c0e8f95edabe4309ed7800c9a9c14
1 parent 4908e39 commit 79e498b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: local-cli/runAndroid/runAndroid.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -253,24 +253,24 @@ function runOnAllDevices(args, cmd, packageNameWithSuffix, packageName, adbPath)
253253
}
254254

255255
function startServerInNewWindow() {
256-
const yargV = require('yargs').argv;
257256
const scriptFile = /^win/.test(process.platform) ?
258257
'launchPackager.bat' :
259258
'launchPackager.command';
260259
const scriptsDir = path.resolve(__dirname, '..', '..', 'scripts');
261260
const launchPackagerScript = path.resolve(scriptsDir, scriptFile);
262261
const procConfig = {cwd: scriptsDir};
262+
const terminal = process.env.REACT_TERMINAL;
263263

264264
if (process.platform === 'darwin') {
265-
if (yargV.open) {
266-
return child_process.spawnSync('open', ['-a', yargV.open, launchPackagerScript], procConfig);
265+
if (terminal) {
266+
return child_process.spawnSync('open', ['-a', terminal, launchPackagerScript], procConfig);
267267
}
268268
return child_process.spawnSync('open', [launchPackagerScript], procConfig);
269269

270270
} else if (process.platform === 'linux') {
271271
procConfig.detached = true;
272-
if (yargV.open){
273-
return child_process.spawn(yargV.open,['-e', 'sh', launchPackagerScript], procConfig);
272+
if (terminal){
273+
return child_process.spawn(terminal, ['-e', 'sh ' + launchPackagerScript], procConfig);
274274
}
275275
return child_process.spawn('sh', [launchPackagerScript], procConfig);
276276

0 commit comments

Comments
 (0)