cargo-wasi
cargo-wasi copied to clipboard
Granting access to files
cargo wasi run -- --dir=.
currently fails, but it's pretty close to working. I found out that after removing arg("--")
the above command succeeds. Is it here intentionally?
https://github.com/bytecodealliance/cargo-wasi/blob/8d1ed3165b2671e9fa791e4e24bcdd5cbf955cf8/src/lib.rs#L180-L183
Yes the --
is currently intentional to ensure that any flags make their way to the binary rather than wasmtime
, but it's true that there's not great handling of --dir
right now.
The thinking is that eventually using interface types we can infer --dir
and other flags, but it's probably good to support flags to wasmtime
itself! What do you think of something like:
$ cargo wasi run --runtime-args "--dir=." -- --flag-to-wasm
or something like that?
Oh, I missed the point that wasm binaries may also receive args )
--runtime-args
sounds great to me. To continue, is it feasible to support config file at some point? After wasi receives networking support, we would like to grant access to ports as well, and all of it reminds me of Dockerfile
Perhaps yeah! I'd prefer to not get too fancy right out the gate though, I would prefer to avoid making too many standards since this is getting to the point where it's probably good feedback for the general set of wasmtime folks to see how the CLI experience is envisioned long-term.
any update?
I ran into this today and wondered if we couldn't do what other nested applications do here:
Namely allow for two different levels of --
where the first level provides arguments like --dir
for Wasmtime and the second --
allows to provide arguments to the Wasm executable ran by Wasmtime.
For example:
cargo wasi run --arg-to-cargo-wasi -- --arg-to-wasmtime -- --arg-to-wasm-file
Sorry if this has already been discussed elsewhere.