pub fn is_executable(metadata: &Metadata) -> boolExpand description
What:
Report whether file metadata says the file can be run.
#[cfg(unix)] and #[cfg(not(unix))] each compile one of the two inner blocks.
Why:
PATH lookup only runs executable files;
a non-executable git is skipped.
On Unix this checks the mode bits,
not the calling user’s access as access(2)
would.
Other systems have no execute bit:
every regular file named by PATHEXT
can run.
The Markdown policy’s linter lookup applies the same test.
In TS you’d write (pseudocode):
function isExecutable(stats: Stats): boolean { return process.platform === 'win32' || (stats.mode & 0o111) !== 0; }