function startElectron (config, ports) { var cmd = ''; var args = null; var debugPortsArgs = [`--debug-brk=${ports[0]}`, `--inspect-brk=${ports[1]}`]; var extraArgs = config.appArgs || []; if (OS.mac && statSync(config.electronPath).isDirectory()) { cmd = 'open'; args = ['-nW', '-a', config.electronPath, '--args'].concat(debugPortsArgs, extraArgs); } else { cmd = config.electronPath; args = debugPortsArgs.concat(extraArgs); } var proc = spawn(cmd, args, { stdio: ['ignore', 'pipe', 'pipe'] }); proc.stdout.on('data', buf => STDOUT_LOGGER(lodash.trimEnd(String(buf), '\n'))); proc.stderr.on('data', buf => STDERR_LOGGER(lodash.trimEnd(String(buf), '\n'))); }
unpackToServer(next) { this.logger.debug('Unpacking pack to server.'); const Exec = Process.spawn('tar', ['-xzf', Path.basename(this.archiveLocation), '-C', this.server.path()], { cwd: Path.dirname(this.archiveLocation), stdio: ['ignore', 'ignore', 'pipe'], }); const stderrLines = []; Exec.stderr.setEncoding('utf8'); Exec.stderr.on('data', data => stderrLines.push(data)); Exec.on('error', execErr => { this.logger.error({ location: this.archiveLocation }, execErr); return next(new Error('There was an error while attempting to decompress this file.')); }); Exec.on('exit', (code, signal) => { if (code !== 0) { this.logger.error({ location: this.archiveLocation, code, signal }, `Failed to decompress server pack archive: ${stderrLines.join('\n')}`); } return next(); }); }