Skip to content

Commit

Permalink
Merge #1054
Browse files Browse the repository at this point in the history
1054: Improve wasmer invoke function r=syrusakbary a=syrusakbary

<!-- 
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests

-->

# Description
Prior to this PR, when executing wasmer, we will have this in the stdout:
 
```bash
➜  wasmer fib32.wasm --invoke fib 30
main() returned: [I32(832040)]
```

Note that it says `main()` returned even if the function called is `fib`.
This PR fixes this and improves the messaging also for WASI invoked functions

<!-- 
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->

# Review

- [x] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Syrus Akbary <[email protected]>
  • Loading branch information
bors[bot] and syrusakbary authored Dec 11, 2019
2 parents c783b7c + 55c7df2 commit 19937ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## **[Unreleased]**

- [#1054](https://github.com/wasmerio/wasmer/pull/1054) Improve `--invoke` output in Wasmer CLI
- [#1053](https://github.com/wasmerio/wasmer/pull/1053) For RuntimeError and breakpoints, use Box<Any + Send> instead of Box<Any>.
- [#1052](https://github.com/wasmerio/wasmer/pull/1052) Fix minor panic and improve Error handling in singlepass backend.
- [#1050](https://github.com/wasmerio/wasmer/pull/1050) Attach C & C++ headers to releases.
Expand Down
4 changes: 2 additions & 2 deletions src/bin/wasmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ fn execute_wasi(
.map_err(|e| format!("Invoke failed: {:?}", e))?
.call(&args)
.map_err(|e| format!("Calling invoke fn failed: {:?}", e))?;
println!("{} returned {:?}", invoke_fn, invoke_result);
println!("{}({:?}) returned {:?}", invoke_fn, args, invoke_result);
return Ok(());
} else {
result = start.call();
Expand Down Expand Up @@ -836,7 +836,7 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
.map_err(|e| format!("{:?}", e))?
.call(&args)
.map_err(|e| format!("{:?}", e))?;
println!("main() returned: {:?}", result);
println!("{}({:?}) returned {:?}", invoke_fn, args, result);
}
}

Expand Down

0 comments on commit 19937ce

Please sign in to comment.