Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement initial-cwd for wasi:cli/environment #9695

Open
ctaggart opened this issue Nov 29, 2024 · 3 comments · May be fixed by #9831
Open

implement initial-cwd for wasi:cli/environment #9695

ctaggart opened this issue Nov 29, 2024 · 3 comments · May be fixed by #9831
Labels
good first issue Issues that are good for new contributors to tackle!

Comments

@ctaggart
Copy link

For https://github.com/WebAssembly/wasi-cli/blob/main/wit/environment.wit, the initial-cwd implementation currently just returns None. Adding this issue highlighted by the FIXME:

fn initial_cwd(&mut self) -> anyhow::Result<Option<String>> {
// FIXME: expose cwd in builder and save in ctx
Ok(None)
}

@alexcrichton
Copy link
Member

This'd perhaps be a good first issue for someone to get their feet wet if they're interested. The general idea to implement this would probably be something like:

  • Add a builder method to WasiCtxBuilder.
  • Fill in initial_cwd linked above to read the WasCtx "built value"
  • This'll still be None by default for backwards-compat
  • The wasmtime CLI can probably grow a few new options:
    • -S cwd=<path> - explicitly setting the path to the cwd
    • (if you're adventurous) -S inherit-fs - inherit the whole filesystem and set the cwd to the process's cwd
    • (if you're extra adventurous) unify -S inherit-* under -S inherit[=fs,network,...] where -S inherit can be "inherit the whole shebang" while -S inherit-fs could be -S inherit=fs.

@alexcrichton alexcrichton added the good first issue Issues that are good for new contributors to tackle! label Dec 2, 2024
@stephenmuss
Copy link

@alexcrichton I'd be keen to have a crack at this.

I have a wip branch and commit at stephenmuss@af44736, would be good to know I'm heading down the right path.

@alexcrichton
Copy link
Member

Looking good! That's mostly just missing a test and should be good to land 👍

@stephenmuss stephenmuss linked a pull request Dec 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues that are good for new contributors to tackle!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants