| 1183 | |
| 1184 | #[test] |
| 1185 | fn p2_cli_stdin() -> Result<()> { |
| 1186 | let mut child = get_wasmtime_command()? |
| 1187 | .args(&["run", "-Wcomponent-model", P2_CLI_STDIN_COMPONENT]) |
| 1188 | .stdout(Stdio::piped()) |
| 1189 | .stderr(Stdio::piped()) |
| 1190 | .stdin(Stdio::piped()) |
| 1191 | .spawn()?; |
| 1192 | child |
| 1193 | .stdin |
| 1194 | .take() |
| 1195 | .unwrap() |
| 1196 | .write_all(b"So rested he by the Tumtum tree") |
| 1197 | .unwrap(); |
| 1198 | let output = child.wait_with_output()?; |
| 1199 | println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); |
| 1200 | println!("stderr: {}", String::from_utf8_lossy(&output.stderr)); |
| 1201 | assert!(output.status.success()); |
| 1202 | Ok(()) |
| 1203 | } |
| 1204 | |
| 1205 | #[test] |
| 1206 | fn p2_cli_splice_stdin() -> Result<()> { |