MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / run

Function run

tests/all/cli_tests.rs:1417–1435  ·  view source on GitHub ↗
(args: &[&str])

Source from the content-addressed store, hash-verified

1415 #[test]
1416 fn p2_cli_stdio_write_flushes() -> Result<()> {
1417 fn run(args: &[&str]) -> Result<()> {
1418 println!("running {args:?}");
1419 let mut child = get_wasmtime_command()?
1420 .args(args)
1421 .stdin(Stdio::piped())
1422 .stdout(Stdio::piped())
1423 .spawn()?;
1424 let mut stdout = child.stdout.take().unwrap();
1425 let mut buf = [0; 10];
1426 match stdout.read(&mut buf) {
1427 Ok(2) => assert_eq!(&buf[..2], b"> "),
1428 e => panic!("unexpected read result {e:?}"),
1429 }
1430 drop(stdout);
1431 drop(child.stdin.take().unwrap());
1432 let status = child.wait()?;
1433 assert!(status.success());
1434 Ok(())
1435 }
1436
1437 run(&["run", "-Spreview2=n", P2_CLI_STDIO_WRITE_FLUSHES])?;
1438 run(&["run", "-Spreview2=y", P2_CLI_STDIO_WRITE_FLUSHES])?;

Callers 1

Calls 11

get_wasmtime_commandFunction · 0.85
OkFunction · 0.85
dropFunction · 0.50
spawnMethod · 0.45
stdoutMethod · 0.45
stdinMethod · 0.45
argsMethod · 0.45
unwrapMethod · 0.45
takeMethod · 0.45
readMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected