File.executable returns incorrect results in Windows 10
Calling File.executable? in Windows 10 return false for a file with execute permissions set.
Updated by jeremyevans0 (Jeremy Evans) 15 days ago
Unlike Unix, Windows doesn't support execute permissions separately. If the path is a regular file, Ruby currently uses file extensions to determine if a file is executable, and only considers the following extensions as executable:
.exe. See https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L5598-L5602
I don't think this is fixable unless we want to make
File.executable? an alias to
File.readable? on Windows, and that would just result in the opposite issue, with
true for files that are just readable and not actually executable.
The documentation for
File.executable_real? does not currently reflect the issues on Windows. Attached is a documentation patch to explain the behavior. I plan to commit this in about a week unless I hear objections.