-
Notifications
You must be signed in to change notification settings - Fork 114
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
Can javy receive command line args / env. Are they in scope? #592
Comments
WASI preview 1 supports environment variables and command line arguments and Javy modules are compiled as WASI preview 1 Wasm modules. However, Javy does not currently expose APIs to read environment variables or command line arguments to the JavaScript source code it runs. We'd be open to a contribution adding those APIs! But I'd recommend proposing and aligning on what those APIs would look like before writing too much code given there isn't a standard API in JavaScript for reading environment variables and command line arguments. |
Hi @jeffcharles , Can be added under Javy object? https://github.com/bytecodealliance/javy/blob/main/npm/javy/src/index.ts The API could be the same / similar API that nodejs exposes. but under Javy:
The data is an array and a map / JS object . |
Have you read through https://github.com/bytecodealliance/javy/blob/main/docs/contributing-architecture.md#javy-apis? The APIs you're proposing make sense to me! I guess before we go too far down this path, what's your use case for getting command line arguments and environment variables? |
No I haven't . Just discovered the process yesterday and I made this https://github.com/ieugen/cherry-wasm-demo . I do DevOps so my focus will be on making some CLI's and tooling to help with that. == Some time into the future This should make app distribution on systems very robust and easy (one tool to install any app / software package you want) . being wasm should work on any architecture. |
Alright, take a look at the process for adding a new API there and let me know if you have any questions!
Have you taken a look at warg? |
Can you teach me rust ? :D
|
Unfortunately I would not have time haha! I used Rustlings and Exercism to learn in the past. And fortunately the changes involved are not too difficult in terms of the amount of Rust knowledge that would be necessary to learn. |
I was able to build javy on my system. |
@jeffcharles : Is wasmtime 17 necessary for this work? https://github.com/bytecodealliance/wasmtime/releases/tag/v17.0.0 It does include wasi preview 2 with env vars and cli args and other things. If that is the case, is there a plan /estimate to update to wasmtime 17 ? |
Wasmtime 17 shouldn't be necessary since Javy will continue to target WASI preview 1 for now. |
I would also have an interest in reading the arguments passed to the WASM runtime in the JavaScript code. |
What is your question?
This is probably a noob question, but here it goes:
Would it be possible to pass command line options to a wasm module?
How about environment variables ?!
I've read https://github.com/bytecodealliance/javy#invoking-javy-generated-modules-programatically .
The text was updated successfully, but these errors were encountered: