From c3f2222a59af4c189562b63c45ead23b02cda5cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Wed, 2 Apr 2025 23:47:37 +0200 Subject: [PATCH] std.zig.system: Make getExternalExecutor() less opinionated about Wasmtime. Wasmtime supports both wasm32 and wasm64, and can run freestanding WASM binaries just fine (although the usefulness of the latter is fairly limited). --- lib/std/zig/system.zig | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index 4c38b19c1d..2a959217d8 100644 --- a/lib/std/zig/system.zig +++ b/lib/std/zig/system.zig @@ -125,6 +125,10 @@ pub fn getExternalExecutor( }; } + if (options.allow_wasmtime and candidate.cpu.arch.isWasm()) { + return Executor{ .wasmtime = "wasmtime" }; + } + switch (candidate.os.tag) { .windows => { if (options.allow_wine) { @@ -142,15 +146,6 @@ pub fn getExternalExecutor( } return bad_result; }, - .wasi => { - if (options.allow_wasmtime) { - switch (candidate.ptrBitWidth()) { - 32 => return Executor{ .wasmtime = "wasmtime" }, - else => return bad_result, - } - } - return bad_result; - }, .macos => { if (options.allow_darling) { // This check can be loosened once darling adds a QEMU-based emulation