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