projecte_ionic/node_modules/@npmcli/git/lib/which.js
2022-02-09 18:30:03 +01:00

17 lines
323 B
JavaScript
Executable file

const which = require('which')
let gitPath
try {
gitPath = which.sync('git')
} catch (e) {}
module.exports = (opts = {}) => {
if (opts.git) {
return opts.git
}
if (!gitPath || opts.git === false) {
return Object.assign(new Error('No git binary found in $PATH'), { code: 'ENOGIT' })
}
return gitPath
}