diff options
| author | Saikari <[email protected]> | 2026-02-21 20:59:43 +0300 |
|---|---|---|
| committer | Saikari <[email protected]> | 2026-02-21 20:59:43 +0300 |
| commit | 54fe033757a7f157f181adb0470572f1963a74cc (patch) | |
| tree | e90709bb3c98e5ef9762c32117ffc92caef5f416 | |
| parent | 30bcf8321661f8bd384eb941ea92e6ad3c7776f3 (diff) | |
try implement runner?
| -rw-r--r-- | xmake/actions/run/main.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua index 6ed59f3f1..d11456cb7 100644 --- a/xmake/actions/run/main.lua +++ b/xmake/actions/run/main.lua @@ -33,6 +33,24 @@ import("private.detect.check_targetname") import("lib.detect.find_tool") import("private.action.utils", {alias = "action_utils"}) +function _run_wasi_target(targetfile, args, opt) + opt = opt or {} + local rundir = opt.rundir + local addenvs = opt.addenvs + local setenvs = opt.setenvs + local wasmtime = find_tool("wasmtime") + if wasmtime then + local runargs = {targetfile} + if args and #args > 0 then + table.join2(runargs, args) + end + os.execv(wasmtime.program, runargs, { + curdir = rundir, detach = option.get("detach"), addenvs = addenvs, setenvs = setenvs}) + else + raise("wasmtime not found, which is required for running wasi target!") + end +end + function _run_wasm_target_in_browser(targetfile, opt) opt = opt or {} local rundir = opt.rundir @@ -81,6 +99,12 @@ function _do_run_target(target) return end + -- run wasi target via wasmtime + if target:is_plat("wasi") then + _run_wasi_target(targetfile, args, {rundir = rundir, addenvs = addenvs, setenvs = setenvs}) + return + end + -- run windows target on non-windows host via wine if not is_host("windows") and target:is_plat("windows") then local wine = assert(find_tool("wine"), "wine not found!") |
