pnpm
Version:
A fast implementation of npm install
20 lines • 825 B
JavaScript
;
const isexe = require('isexe');
const fs = require('fs');
const semver = require('semver');
const isWindows = process.platform === 'win32';
const preserveSymlinks = semver.satisfies(process.version, '>=6.3.0');
function isExecutable(t, filePath) {
if (!isWindows && !preserveSymlinks) {
const lstat = fs.lstatSync(filePath);
t.ok(lstat.isSymbolicLink(), filePath + ' symlink is available');
const stat = fs.statSync(filePath);
t.equal(stat.mode, parseInt('100755', 8), filePath + ' is executable');
t.ok(stat.isFile(), filePath + ' refers to a file');
return;
}
t.ok(isexe(filePath), filePath + ' is executable');
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = isExecutable;
//# sourceMappingURL=isExecutable.js.map