diff options
| -rw-r--r-- | xmake/actions/run/main.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua index 6cfe09d3a..080804ad6 100644 --- a/xmake/actions/run/main.lua +++ b/xmake/actions/run/main.lua @@ -59,6 +59,16 @@ function _do_run_target(target) targetfile = wine.program end + -- run wasm target in browser + if target:is_plat("wasm") then + local python = assert(find_tool("python3"), "python not found! python is required for running wasm target in browser!") + local url = "http://localhost:8000/" .. path.relative(targetfile, rundir):gsub("\\", "/") + print("please open the url in browser") + cprint("${color.success}%s${clear}", url) + os.execv(python.program, {"-m", "http.server"}, {curdir = rundir, detach = option.get("detach"), addenvs = addenvs, setenvs = setenvs}) + return + end + -- debugging? if option.get("debug") then debugger.run(targetfile, args, {curdir = rundir, addenvs = addenvs, setenvs = setenvs}) |
