Skip to content

Accept --export to pick which func to run#153

Merged
jbourassa merged 1 commit intomainfrom
jb/export-name
Jul 5, 2023
Merged

Accept --export to pick which func to run#153
jbourassa merged 1 commit intomainfrom
jb/export-name

Conversation

@jbourassa
Copy link
Contributor

With --export (or -e), users can specify which function to invoke. This is similar to Wasmtime's CLI --invoke.

Some decisions:

  • The flag is either --export or -e: most other flags also had long and short variants, so I followed the pattern.
  • The export name is required in engine run and defaults at the CLI level: mostly because it was the easiest.
  • Let Wasmtime's error message bubble: I think it's explicit enough.
$ cargo run -- -f benchmark/build/exports.wasm <(echo "{}")
Error: failed to find function export `_start`

#gsd:34464

Copy link
Contributor

@dphm dphm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how to try it out but it makes sense to me!

@jbourassa
Copy link
Contributor Author

Not sure how to try it out

Checkout the branch and run :

cargo run -- -f benchmark/build/exports.wasm <(echo "{}") -e export1

where:

  • -e or --export specify the export
  • <(echo "{}") is a fancy way of specifying an empty JSON file

@jbourassa jbourassa merged commit f637dec into main Jul 5, 2023
@jbourassa jbourassa deleted the jb/export-name branch July 5, 2023 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants