#Execute file from package dependency

1 messages · Page 1 of 1 (latest)

toxic cargo
#

I have a binary dependency in my build.zig.zon. I can get the LazyPath to the executable using const dep_bin = dep.path("bin/mydep");. I then create a run step using

const dep_run = std.Build.Step.Run.create(b, "run mydep");
dep_run.addFileArg(dep_bin);

But since the dependency package is extracted from a zip file the file access modifier is -rw-r--r-- and I get an AccessDenied error during zig build.
My current plan is to add a custom build step that calls std.posix.fchmod on the executable before the run step.

Just checking if there is an easier way to do this. Host platforms are macOS and Linux. But might add Windows at some point.

#

What's interesting is when I just download and unzip the package the file access modifiers are preserved: -rwxr-xr-x. So it's not a limit of the Zip archive.
Maybe this is a limitation of Zig package manager? Or a security feature?