Struct assert_cmd::stdin::StdInCommandBuilder
source · pub struct StdInCommandBuilder<'a> { /* private fields */ }
Expand description
For adding a stdin to a Command
.
Implementations§
source§impl<'a> StdInCommandBuilder<'a>
impl<'a> StdInCommandBuilder<'a>
sourcepub fn path<P>(&mut self, file: P) -> Result<StdInCommand<'_>>where
P: AsRef<Path>,
pub fn path<P>(&mut self, file: P) -> Result<StdInCommand<'_>>where
P: AsRef<Path>,
Write path
s content to stdin
when the Command
is run.
Paths are relative to the env::current_dir
and not
Command::current_dir
.
Examples
use assert_cmd::prelude::*;
use std::process::Command;
let mut cmd = Command::new("cat");
cmd
.arg("-A")
.with_stdin()
.path("Cargo.toml")
.unwrap();
let output = cmd.unwrap();