use mxsh::ShellBuilder;
use mxsh::embed::{StdioConfig, VariableAttributes};
use mxsh::runtime::testing::{InMemoryRuntime, StringStdioOut};
fn main() {
let stdout = StringStdioOut::new();
let mut shell = ShellBuilder::new()
.env("GREETING", "hello", VariableAttributes::EXPORT)
.stdio(StdioConfig {
stdout: stdout.fd(),
..StdioConfig::default()
})
.build(InMemoryRuntime::new())
.expect("shell should build");
let result = shell.run("echo \"$GREETING embedded shell\"");
assert_eq!(result.status, 0);
assert_eq!(stdout.collect(), "hello embedded shell\n");
}