Method: File.executable_real?

Defined in:
file.c

.executable_real?(file_name) ⇒ Boolean

Returns true if the named file is executable by the real user and group id of this process. See access(3).

Windows does not support execute permissions separately from read permissions. On Windows, a file is only considered executable if it ends in .bat, .cmd, .com, or .exe.

Note that some OS-level security features may cause this to return true even though the file is not executable by the real user/group.

Returns:

  • (Boolean)


1960
1961
1962
1963
1964
1965
# File 'file.c', line 1960

static VALUE
rb_file_executable_real_p(VALUE obj, VALUE fname)
{
    if (rb_access(fname, X_OK) < 0) return Qfalse;
    return Qtrue;
}