Stream: git-wasmtime

Topic: wasmtime / PR #9831 Implement initial-cwd for wasi:cli/en...


view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 10:56):

stephenmuss opened PR #9831 from stephenmuss:initial-cwd to bytecodealliance:main:

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
This implements initial-cwd for wasi:cli/environment.

My biggest struggle was finding the appropriate places to add tests. Any guidance would be appreciated. Thank you.

Closes #9695

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 10:56):

stephenmuss requested fitzgen for a review on PR #9831.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 10:56):

stephenmuss requested wasmtime-core-reviewers for a review on PR #9831.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2024 at 15:55):

alexcrichton commented on PR #9831:

Thanks! I'd recommend adding a test to crates/test-programs/bin/*.rs and there's a small README about the tests in that directory.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 17 2024 at 00:15):

stephenmuss commented on PR #9831:

I assume I should be able to use something like this in crates/test-programs/bin/*.rs to test

fn main() -> std::io::Result<()> {
    let cwd = std::env::current_dir()?;
    assert_eq!(cwd.to_str(), Some("/tmp"));
    Ok(())
}

and run with -S cwd=/tmp.

Is that understanding correct?

However, I always get Some("/") indicating that I still need to set the path somewhere I've missed, presumably in src/commands/run.rs and src/commands/serve.rs etc.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 17 2024 at 15:25):

alexcrichton commented on PR #9831:

Ah you'll probably need to use the WASI API directly rather than the standard library because the standard library isn't hooked up to this API yet.


Last updated: Dec 23 2024 at 13:07 UTC