-
Notifications
You must be signed in to change notification settings - Fork 824
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
fix unwrap error when given a no export functions wasm #2386
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! Merging!
bors r+ |
2386: fix unwrap error when given a no export functions wasm r=syrusakbary a=chenyukang # Description When the wasm file contains no export functions, an unwrap crash will trigger: ``` thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', lib/cli/src/commands/run.rs:344:52 ``` This fix will give a more detailed output. Co-authored-by: chenyukang <[email protected]>
I found another issue when adding testcase, my code is not executed when I run: cargo test --package wasmer-integration-tests-cli --test run -- run_no_start_wasm_report_error --exact --nocapture This is because WASMER_PATH only uses the release path, but I run it with debug version. pub const WASMER_PATH: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../../../target/release/wasmer"
); To keep it consistent, we should fix this: #[cfg(feature = "debug")]
pub const WASMER_PATH: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../../../target/debug/wasmer"
);
#[cfg(not(feature = "debug"))]
pub const WASMER_PATH: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../../../target/release/wasmer"
); @syrusakbary How do you think about it? |
Canceled. |
I think that’s a good change/fix! Happy to merge it on this PR as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
The one thing I'd say, is that the I don't think the |
bors r+ |
👍 thanks for the PR! |
Description
When the wasm file contains no export functions, an unwrap crash will trigger:
This fix will give a more detailed output.