2015-10-20 09:53:54 -07:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
2015-09-14 15:35:58 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var path = require('path');
|
|
|
|
var child_process = require('child_process');
|
|
|
|
|
|
|
|
module.exports = function(newWindow) {
|
|
|
|
if (newWindow) {
|
2015-09-28 20:10:01 +01:00
|
|
|
var launchPackagerScript =
|
|
|
|
path.resolve(__dirname, '..', 'packager', 'launchPackager.command');
|
|
|
|
if (process.platform === 'darwin') {
|
|
|
|
child_process.spawnSync('open', [launchPackagerScript]);
|
|
|
|
} else if (process.platform === 'linux') {
|
|
|
|
child_process.spawn(
|
|
|
|
'xterm',
|
|
|
|
['-e', 'sh', launchPackagerScript],
|
|
|
|
{detached: true});
|
|
|
|
}
|
2015-09-14 15:35:58 +01:00
|
|
|
} else {
|
2015-10-01 15:26:05 +01:00
|
|
|
if (/^win/.test(process.platform)) {
|
|
|
|
child_process.spawn('node', [
|
2015-10-01 15:33:45 +01:00
|
|
|
path.resolve(__dirname, '..', 'packager', 'packager.js'),
|
|
|
|
'--projectRoots',
|
|
|
|
process.cwd(),
|
2015-10-01 15:26:05 +01:00
|
|
|
], {stdio: 'inherit'});
|
|
|
|
} else {
|
|
|
|
child_process.spawn('sh', [
|
|
|
|
path.resolve(__dirname, '..', 'packager', 'packager.sh'),
|
|
|
|
'--projectRoots',
|
|
|
|
process.cwd(),
|
|
|
|
], {stdio: 'inherit'});
|
|
|
|
}
|
2015-09-14 15:35:58 +01:00
|
|
|
}
|
2015-09-28 20:10:01 +01:00
|
|
|
};
|