Check for executable permissions in is_executable (#11430)

e.g., as in
https://docs.rs/is_executable/latest/src/is_executable/lib.rs.html#44
This commit is contained in:
Zanie Blue
2025-02-12 13:50:29 -06:00
committed by GitHub
parent 7154800e0c
commit de67d5453d
+5 -2
View File
@@ -27,9 +27,12 @@ pub fn is_executable(path: &Path) -> bool {
}
}
if cfg!(not(target_os = "windows")) {
#[cfg(not(target_os = "windows"))]
{
use std::os::unix::fs::PermissionsExt;
if !fs_err::metadata(path)
.map(|metadata| metadata.is_file())
.map(|metadata| metadata.is_file() && metadata.permissions().mode() & 0o111 != 0)
.unwrap_or(false)
{
return false;