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'))); }