fix(cli): make exe run on the host even when custom args are passed

This commit is contained in:
Nurul Huda (Apon) 2026-02-26 17:59:32 +06:00
parent 5d61315cb3
commit 7902e22263
No known key found for this signature in database
GPG Key ID: 5D3F1DE2855A2F79
3 changed files with 9 additions and 3 deletions

View File

@ -7,10 +7,16 @@ pub fn init(b: *std.Build, exe: *std.Build.Step.Compile, options: ZxInitOptions)
const optimize = exe.root_module.optimize;
const build_zig = @import("../../build.zig");
const zx_dep = b.dependencyFromBuildZig(build_zig, .{ .target = target, .optimize = optimize });
const zx_runner_dep = b.dependencyFromBuildZig(build_zig, .{
.optimize = optimize,
// Passing target here will cause it to compile for the target passed, but when the target is not the host machine we will try executing
// zx transpile with the binary for the target machine which will fail.
// .target = target,
});
const zx_module = zx_dep.module("zx");
const zx_wasm_module = zx_dep.module("zx_wasm");
const zx_exe = zx_dep.artifact("zx");
const zx_exe = zx_runner_dep.artifact("zx");
var opts: InitInnerOptions = .{
.site_path = b.path("app"),

View File

@ -989,7 +989,7 @@ pub fn Handler(comptime AppCtxType: type) type {
_ = path_writer.write("/") catch break;
}
}
const parent_path = path_buf[0 .. path_stream.getPos() catch break];
const parent_path = path_buf[0..@intCast(path_stream.getPos() catch break)];
// Find route with matching path
// Skip if this parent path matches the current route (avoid double application)

View File

@ -100,7 +100,7 @@ pub fn Cache(comptime T: type) type {
fn getSegment(self: *const Self, key: []const u8) *Segment(T) {
const hash_code = std.hash.Wyhash.hash(0, key);
return &self.segments[hash_code & self.segment_mask];
return &self.segments[@intCast(hash_code & self.segment_mask)];
}
};
}