which(command) { return new Promise(resolve => which(command, (error, resolvedPath) => resolve({ resolvedPath: resolvedPath, error: error ? error.message : null }))); }
function getPipExe() { const pip = which.sync("pip3", { nothrow: true }) || which.sync("pip", { nothrow: true }); if (pip) { return pip; } // try python -m pip const pythonExe = getPythonExe(); return new Promise((resolve, reject) => { var child = spawn(pythonExe, ["-m", "pip"]); child.on("close", code => { if (code === 0) resolve([pythonExe, "-m", "pip"]); else resolve(); }); }); }
let settings = require(settingsFile); signale.pending(`Resolving shell path...`); settings.shell = await which(settings.shell).catch(e => { throw(e) }); signale.info(`Shell found at ${settings.shell}`); signale.success(`Settings loaded!`);
const startOpenvpn = (options = []) => { logger.info('Starting openvpn...'); const openvpn = `"${which.sync('openvpn')}"`; const proc = execa(openvpn, ['--config', `"${filePath}"`].concat(options), { shell: true }); proc.stdout.pipe(logger.stream); proc.stderr.on('data', data => logger.error(data.toString())); proc.on('close', code => logger.info(`child process exited with code ${code}`)); process.on('exit', () => proc.kill()); process.on('SIGINT', () => proc.kill()); return proc; }
which('git', (e, git) => { if (e) return reject(e) const args = prefix.concat(cmds) execFile(git, args, opt, (e, stdout) => { if (e) return reject(e) resolve(stdout) }) })
t.test('npm doctor ping returns 404 (or any other error)', function (t) { npm.commands.doctor({ 'node-url': node_url }, true, function (e, list) { t.ifError(e, 'npm loaded successfully') t.same(list.length, 9, 'list should have 9 prop') t.same(list[0][1], 'failed', 'npm ping') t.same(list[1][1], 'v' + npm.version, 'npm -v') t.same(list[2][1], process.version, 'node -v') t.same(list[3][1], common.registry + '/', 'npm config get registry') t.same(list[5][1], 'ok', 'Perms check on cached files') t.same(list[6][1], 'ok', 'Perms check on global node_modules') t.same(list[7][1], 'ok', 'Perms check on local node_modules') t.match(list[8][1], /^verified \d+ tarballs?$/, 'Cache verified') which('git', function (e, resolvedPath) { t.ifError(e, 'git command is installed') t.same(list[4][1], resolvedPath, 'which git') t.done() }) }) })
async function getBinaryPath({ execPath }) { const path = execPath || binPath return path ? path : binPath = await which('tesseract') }
async function findInPath () { return new Promise((resolve, reject) => { const keys = Object.keys(cmd); for (const key of keys) { try { cmd[key] = which.sync(key); } catch (err) { if (isDramatic(err.toString())) { return reject(new Error('Warning: tools.findInPath: ' + err)); } } } resolve(); }); }
this._isNinjaAvailable = false; try { if (which.sync("ninja")) { this._isNinjaAvailable = true; this._isMakeAvailable = false; try { if (which.sync("make")) { this._isMakeAvailable = true; this._isGPPAvailable = false; try { if (which.sync("g++")) { this._isGPPAvailable = true; this._isClangAvailable = false; try { if (which.sync("clang++")) { this._isClangAvailable = true;
if (which.sync(browser, { nothrow: true })) { return resolve(); } else {
return which.sync(pythonName, { path : _sofficeActualDirectory }); _whichSoffice = which.sync(sofficeName, { path : paths.join(':'), nothrow : true }) || which.sync(sofficeName, { nothrow : true }) || null; (paths.length > 0 && which.sync('python3', { path : paths.join(':'), nothrow : true })) || (paths.length > 0 && which.sync('python', { path : paths.join(':'), nothrow : true })) || which.sync('python3', { nothrow : true }) || which.sync('python', { nothrow : true }) || null; return { soffice : _whichSoffice,
which(command, function (err, execPath) { if (err) {
let settings = require(settingsFile); signale.pending(`Resolving shell path...`); settings.shell = await which(settings.shell).catch(e => { throw(e) }); signale.info(`Shell found at ${settings.shell}`); signale.success(`Settings loaded!`);