vm: enable optional input and output data
This commit is contained in:
parent
bc41781df0
commit
7dee69f35b
12
src/vm.rs
12
src/vm.rs
|
@ -583,7 +583,7 @@ impl VirtualMachine {
|
||||||
"path": command,
|
"path": command,
|
||||||
"arg": args,
|
"arg": args,
|
||||||
"capture-output": true,
|
"capture-output": true,
|
||||||
"input-data": input,
|
"input-data": input.unwrap_or_default(),
|
||||||
});
|
});
|
||||||
|
|
||||||
let bar = spinner(format!("Running: {command:?} {args:?}"));
|
let bar = spinner(format!("Running: {command:?} {args:?}"));
|
||||||
|
@ -609,11 +609,13 @@ impl VirtualMachine {
|
||||||
}
|
}
|
||||||
bar.finish_and_clear();
|
bar.finish_and_clear();
|
||||||
|
|
||||||
let out_data = status
|
let out_data = if let Some(out_data) = status.get("out-data") {
|
||||||
.get("out-data")
|
out_data
|
||||||
.ok_or(eyre::eyre!("response had no out-data"))?
|
|
||||||
.as_str()
|
.as_str()
|
||||||
.ok_or(eyre::eyre!("response['out-data'] is not string"))?;
|
.ok_or(eyre::eyre!("response['out-data'] is not string"))?
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
};
|
||||||
let parsed_data = BASE64_STANDARD
|
let parsed_data = BASE64_STANDARD
|
||||||
.decode(out_data)
|
.decode(out_data)
|
||||||
.context("response output was not base64")?;
|
.context("response output was not base64")?;
|
||||||
|
|
Loading…
Reference in New Issue