Merge branch 'master' into feature/remove-call-protected

This commit is contained in:
Lachlan Sneff 2019-04-12 11:50:39 -07:00 committed by GitHub
commit 8b2f613649
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 7 deletions

View File

@ -6,5 +6,6 @@ Blocks of changes will separated by version increments.
## **[Unreleased]** ## **[Unreleased]**
- [#348](https://github.com/wasmerio/wasmer/pull/348) Refactor internal runtime ↔️ backend abstraction. - [#348](https://github.com/wasmerio/wasmer/pull/348) Refactor internal runtime ↔️ backend abstraction.
- [#351](https://github.com/wasmerio/wasmer/pull/351) Add hidden option to specify wasm program name (can be used to improve error messages)
- [#350](https://github.com/wasmerio/wasmer/pull/350) Enforce that CHANGELOG.md is updated through CI. - [#350](https://github.com/wasmerio/wasmer/pull/350) Enforce that CHANGELOG.md is updated through CI.
- [#349](https://github.com/wasmerio/wasmer/pull/349) Add [CHANGELOG.md](https://github.com/wasmerio/wasmer/blob/master/CHANGELOG.md). - [#349](https://github.com/wasmerio/wasmer/pull/349) Add [CHANGELOG.md](https://github.com/wasmerio/wasmer/blob/master/CHANGELOG.md).

View File

View File

View File

@ -83,6 +83,9 @@ struct Run {
#[structopt(long = "em-symbol-map", parse(from_os_str))] #[structopt(long = "em-symbol-map", parse(from_os_str))]
em_symbol_map: Option<PathBuf>, em_symbol_map: Option<PathBuf>,
#[structopt(long = "command-name", hidden = true)]
command_name: Option<String>,
/// Application arguments /// Application arguments
#[structopt(name = "--", raw(multiple = "true"))] #[structopt(name = "--", raw(multiple = "true"))]
args: Vec<String>, args: Vec<String>,
@ -300,12 +303,16 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
( (
InstanceABI::WASI, InstanceABI::WASI,
wasmer_wasi::generate_import_object( wasmer_wasi::generate_import_object(
[options.path.to_str().unwrap().to_owned()] if let Some(cn) = &options.command_name {
.iter() [cn.clone()]
.chain(options.args.iter()) } else {
.cloned() [options.path.to_str().unwrap().to_owned()]
.map(|arg| arg.into_bytes()) }
.collect(), .iter()
.chain(options.args.iter())
.cloned()
.map(|arg| arg.into_bytes())
.collect(),
env::vars() env::vars()
.map(|(k, v)| format!("{}={}", k, v).into_bytes()) .map(|(k, v)| format!("{}={}", k, v).into_bytes())
.collect(), .collect(),
@ -329,7 +336,11 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
&module, &module,
&mut instance, &mut instance,
abi, abi,
options.path.to_str().unwrap(), if let Some(cn) = &options.command_name {
cn
} else {
options.path.to_str().unwrap()
},
options.args.iter().map(|arg| arg.as_str()).collect(), options.args.iter().map(|arg| arg.as_str()).collect(),
) )
.map_err(|e| format!("{:?}", e))?; .map_err(|e| format!("{:?}", e))?;