const windowSimulator = () => { const projInfo = JSON.parse(fs.readFileSync(path.join(__dirname, '../lib/projInfo.js'))); //Simulation for CRA if (projInfo.devServerScript === 'start') { const child = spawn('npm', ['start'], {cwd: projInfo.rootPath}); child.stdout.on('data', (data) => { global.mainWindow.webContents.send('start simulator',['http://localhost:3000',child.pid]); }); //Simulation for react-dev-server } else if (projInfo.devServerScript === 'run dev-server') { let child = spawn('npm', ['run', 'reactide-server'], {cwd: projInfo.rootPath}); child.stdout.on('data', (data) => { global.mainWindow.webContents.send('start simulator',['http://localhost:8085', child.pid]); }) } else if (projInfo.htmlPath) { global.mainWindow.webContents.send('file://' + projInfo.htmlPath); } else { console.log('No Index.html found'); } }
waitForServer(BACKEND_SERVER_URL).then(() => { runYarnCommand('start:serviceTests').on('exit', code => { process.exitCode = code; // success of this script depends on the success of the tests treeKill(server.pid); runYarnCommand('server:dropDatabase'); }); });
const runYarnCommand = (cmd: string) => { const child = spawn('yarn', [cmd], { cwd: __dirname + '/..', env: process.env }); const pid = child.pid; children.push(pid); child.stdout.pipe(process.stdout); child.stderr.pipe(process.stderr); child.on('exit', (code, signal) => { console.log(`${cmd} exited with code ${code} and signal ${signal} (pid: ${pid})`); }); return child; }
kill () { console.log('kill() [pid:%d]', this._process.pid); this._process.kill('SIGINT'); }
setTimeout(() => { terminate(child.pid) timedout = true }, mutodeInstance.timeout).unref()
}); app.pid = ps.pid; app.state = 'runing'; this.emit('state', app);
pipeName : _pipeName, userCachePath : _userCachePath, pid : _officeThread.pid, officeThread : _officeThread, pythonThread : _pythonThread,
var spawn = require('child_process').spawn; var child = spawn(process.execPath, [__filename, 'child'], {env: {NODE_DEBUG: environ}}); expectErr = expectErr.split('%PID%').join(child.pid); var err = ''; child.stderr.setEncoding('utf8');
var msg = 'Timed out waiting for process to start'; while ((await common.fires(instance.nextStderrString(), msg, TIMEOUT)) !== 'started') {} process._debugProcess(instance._process.pid); return instance; };
kill () { console.log('kill() [pid:%d]', this._process.pid); this._process.kill('SIGINT'); }