| 123456789101112131415161718192021222324252627 |
- const config = require('./config');
- const child_process = require('child_process');
- var os = require('os');
- config.servers.forEach((host, index) => {
- var cmd;
- if (os.platform() == 'darwin') {
- var cmd = [
- 'osascript -e \'tell application "Terminal" to activate\' ',
- '-e \'tell application "System Events" to tell process "Terminal" to keystroke "t"',
- "using command down' ",
- '-e \'tell application "Terminal" to do script',
- '"',
- `cd ${__dirname} && node server.js ${host} ${index}`,
- '"',
- "in selected tab of the front window'",
- ].join('');
- } else {
- cmd = `start cmd.exe /K "cd /d ${__dirname} && node server.js ${host} ${index}"`;
- }
- var child = child_process.exec(cmd);
- child.on('exit', function(code) {
- console.log('child exit');
- });
- });
|