You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the Text Format specification does not define a means to call a WASM executable from within the WAT file, see bytecodealliance/wasmtime#3715.
Comment ;; at position 0 and 1 in WAT followed by #!1 invokes the following until end of line as WAT executable, optionally followed by arguments to WAT executable where lines 1-N are interpreted as WAT for WASM executable to execute.
The above change should not affect existing WAT usage, where it is highly unlikely WAT files in existence contain that precise sequence of characters at positions 0-3 in the file.
I found this limitation when using wasmtime to execute WASM as a Native Messaging host.
This is the current workaround I'm using to use WAT in a Bash sheel script, call wasmtime (which does not exit when the parent exits) using WAT Text Format in the same file, then terminate wasmtime in a separate script when the Native Messaging host exits.
If the WAT file starts with a # followed by an ! everything from the start of the file until the first newline shall be interpreted as comment.
;;#! is not something that any OS will interpret. It can only be interpreted once a program that supports reading WAT files has already started at which point I don't think there should be a possibility to run another program instead. UNIX systems only interpret #! at the start of the file without anything before it to determine which program to run.
Currently the Text Format specification does not define a means to call a WASM executable from within the WAT file, see bytecodealliance/wasmtime#3715.
Reading the specification(s) https://github.com/WebAssembly/spec/blob/4c249c5a575e2b0e252e747af261bbb82f448dd4/interpreter/README.md, https://webassembly.github.io/spec/core/text/conventions.html#grammar this sounds reasonable
file.wat
Prospective specification text:
The above change should not affect existing WAT usage, where it is highly unlikely WAT files in existence contain that precise sequence of characters at positions 0-3 in the file.
I found this limitation when using
wasmtime
to execute WASM as a Native Messaging host.This is the current workaround I'm using to use WAT in a Bash sheel script, call
wasmtime
(which does not exit when the parent exits) using WAT Text Format in the same file, then terminatewasmtime
in a separate script when the Native Messaging host exits.nm_c_wat.sh
kill_wasmtime.sh
Pros, cons, discussion. I cannot champion this because W3C banned me. So either one of you champion this or it doesn't happen.
1. The #! magic, details about the shebang/hash-bang mechanism on various Unix flavours
The text was updated successfully, but these errors were encountered: