aboutsummaryrefslogtreecommitdiff
path: root/src/which.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/which.zig')
-rw-r--r--src/which.zig6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/which.zig b/src/which.zig
index 6c0828e7b..abf5d57f7 100644
--- a/src/which.zig
+++ b/src/which.zig
@@ -10,11 +10,9 @@ fn isValid(buf: *[bun.MAX_PATH_BYTES]u8, segment: []const u8, bin: []const u8) ?
return @intCast(u16, filepath.len);
}
+extern "C" fn is_executable_file(path: [*:0]const u8) bool;
fn checkPath(filepath: [:0]const u8) bool {
- // TODO: is there a single system call for executable AND file?
- std.os.accessZ(filepath, std.os.X_OK) catch return false;
- std.os.accessZ(filepath, std.os.F_OK) catch return false;
- return true;
+ return is_executable_file(filepath);
}
// Like /usr/bin/which but without needing to exec a child process