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

Example: How to terminate a program via an Import #1597

Closed
syrusakbary opened this issue Sep 7, 2020 · 0 comments · Fixed by #1657
Closed

Example: How to terminate a program via an Import #1597

syrusakbary opened this issue Sep 7, 2020 · 0 comments · Fixed by #1657
Assignees
Labels
1.0 Wasmer at 1.0 bug Something isn't working 🧞 needs example The issue needs an example on how to do it

Comments

@syrusakbary
Copy link
Member

From the Slack channel, we got this question:

from the C api is there a way to signal that the wasm client application should terminate
suppose my wasm program calls fancy_exit( some parameters );
which is an import provided by the host.
I dont want to return to executing code in the wasm client after processing the exit call

Right now, this is possible via the Rust API (WASI is using this strategy):

  1. First, an import is provided - https://github.com/wasmerio/wasmer/blob/master/lib/wasi/src/lib.rs#L297
  2. This import, when getting called raises an error - https://github.com/wasmerio/wasmer/blob/master/lib/wasi/src/syscalls/mod.rs#L2493-L2497
  3. The application listens from this error when starting the instance - https://github.com/wasmerio/wasmer/blob/master/lib/cli/src/commands/run/wasi.rs#L69-L76

For closing this issue we will need:

  • Complete Example in Rust (without WASI)
  • Complete example in C
@syrusakbary syrusakbary added bug Something isn't working 🧞 needs example The issue needs an example on how to do it labels Sep 7, 2020
@MarkMcCaskey MarkMcCaskey added the 1.0 Wasmer at 1.0 label Sep 21, 2020
@MarkMcCaskey MarkMcCaskey self-assigned this Sep 28, 2020
@bors bors bot closed this as completed in d924639 Sep 30, 2020
@bors bors bot closed this as completed in #1657 Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0 Wasmer at 1.0 bug Something isn't working 🧞 needs example The issue needs an example on how to do it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants