From cd54db1e4b03ee9048740fa993d5878870dff61b Mon Sep 17 00:00:00 2001 From: robobun Date: Mon, 21 Jul 2025 19:47:00 -0700 Subject: [PATCH] Fix Windows cross-compilation missing executable permissions (#21268) Co-authored-by: Claude Bot Co-authored-by: Claude Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- src/StandaloneModuleGraph.zig | 4 ++++ src/bun.js/bindings/CustomGetterSetter.zig | 4 ++-- src/bun.js/bindings/SourceProvider.zig | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/StandaloneModuleGraph.zig b/src/StandaloneModuleGraph.zig index d0d9fab8bf..7b2e96a42d 100644 --- a/src/StandaloneModuleGraph.zig +++ b/src/StandaloneModuleGraph.zig @@ -718,6 +718,10 @@ pub const StandaloneModuleGraph = struct { cleanup(zname, cloned_executable_fd); Global.exit(1); }; + // Set executable permissions when running on POSIX hosts, even for Windows targets + if (comptime !Environment.isWindows) { + _ = bun.c.fchmod(cloned_executable_fd.native(), 0o777); + } return cloned_executable_fd; }, else => { diff --git a/src/bun.js/bindings/CustomGetterSetter.zig b/src/bun.js/bindings/CustomGetterSetter.zig index 783d7602e5..698dec2d48 100644 --- a/src/bun.js/bindings/CustomGetterSetter.zig +++ b/src/bun.js/bindings/CustomGetterSetter.zig @@ -1,5 +1,3 @@ -const bun = @import("bun"); - pub const CustomGetterSetter = opaque { pub fn isGetterNull(this: *CustomGetterSetter) bool { return bun.cpp.JSC__CustomGetterSetter__isGetterNull(this); @@ -9,3 +7,5 @@ pub const CustomGetterSetter = opaque { return bun.cpp.JSC__CustomGetterSetter__isSetterNull(this); } }; + +const bun = @import("bun"); diff --git a/src/bun.js/bindings/SourceProvider.zig b/src/bun.js/bindings/SourceProvider.zig index 13f974cd67..97cad03ec0 100644 --- a/src/bun.js/bindings/SourceProvider.zig +++ b/src/bun.js/bindings/SourceProvider.zig @@ -1,8 +1,8 @@ -const bun = @import("bun"); - /// Opaque representation of a JavaScript source provider pub const SourceProvider = opaque { pub fn deref(provider: *SourceProvider) void { bun.cpp.JSC__SourceProvider__deref(provider); } }; + +const bun = @import("bun");