2016-10-10 02:26:47 -08:00
|
|
|
/*
|
|
|
|
|
* Based on https://github.com/kevva/executable
|
|
|
|
|
* Since this module doesn't expose the function to check stat mode only,
|
|
|
|
|
* his logic is pasted here.
|
|
|
|
|
*
|
|
|
|
|
* Opened an issue and a pull request about it,
|
|
|
|
|
* to maybe switch to module in the future:
|
|
|
|
|
*
|
|
|
|
|
* Issue: https://github.com/kevva/executable/issues/9
|
|
|
|
|
* PR: https://github.com/kevva/executable/pull/10
|
|
|
|
|
*/
|
2016-08-01 14:52:21 -08:00
|
|
|
|
2016-09-21 06:27:11 -08:00
|
|
|
export function isExecutable(fileStat) {
|
|
|
|
|
if (process.platform === 'win32') {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2016-08-01 14:52:21 -08:00
|
|
|
|
|
|
|
|
return Boolean(
|
2016-09-21 06:27:11 -08:00
|
|
|
(fileStat.mode & parseInt('0001', 8)) ||
|
|
|
|
|
(fileStat.mode & parseInt('0010', 8)) ||
|
|
|
|
|
(fileStat.mode & parseInt('0100', 8))
|
2016-08-01 14:52:21 -08:00
|
|
|
);
|
|
|
|
|
}
|