| 3382 | } |
| 3383 | |
| 3384 | fn wizen(args: &[&str], wat: &str) -> Result<Output> { |
| 3385 | let mut cmd = get_wasmtime_command()?; |
| 3386 | cmd.arg("wizer").args(args).arg("-"); |
| 3387 | cmd.stdin(Stdio::piped()) |
| 3388 | .stdout(Stdio::piped()) |
| 3389 | .stderr(Stdio::piped()); |
| 3390 | let mut child = cmd.spawn()?; |
| 3391 | let mut stdin = child.stdin.take().unwrap(); |
| 3392 | stdin.write_all(wat.as_bytes())?; |
| 3393 | drop(stdin); |
| 3394 | |
| 3395 | let output = child.wait_with_output()?; |
| 3396 | if !output.status.success() { |
| 3397 | println!( |
| 3398 | "Failed to execute wasmtime wizer with: {cmd:?}\n{}", |
| 3399 | String::from_utf8_lossy(&output.stderr) |
| 3400 | ); |
| 3401 | } |
| 3402 | Ok(output) |
| 3403 | } |
| 3404 | |
| 3405 | #[test] |
| 3406 | fn wizer_no_imports_by_default() -> Result<()> { |