mirror of
https://github.com/nodejs/node.git
synced 2025-05-13 07:34:30 +00:00

PR-URL: https://github.com/nodejs/node/pull/38254 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
17 lines
323 B
JavaScript
17 lines
323 B
JavaScript
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
|
|
}
|