Add stdin to run_make_support::command::Command

This commit is contained in:
Jerry Wang 2024-06-22 14:14:01 -04:00
parent 6db3289de7
commit 5a66a796fc
No known key found for this signature in database
GPG Key ID: B9657729C5192EDC
4 changed files with 7 additions and 5 deletions

View File

@ -36,8 +36,10 @@ impl Command {
Self { cmd: StdCommand::new(program), stdin: None, drop_bomb: DropBomb::arm(program) }
}
pub fn set_stdin(&mut self, stdin: Box<[u8]>) {
self.stdin = Some(stdin);
/// Specify a stdin input
pub fn stdin<I: AsRef<[u8]>>(&mut self, input: I) -> &mut Self {
self.stdin = Some(input.as_ref().to_vec().into_boxed_slice());
self
}
/// Specify an environment variable.

View File

@ -171,7 +171,7 @@ impl LlvmFilecheck {
/// Pipe a read file into standard input containing patterns that will be matched against the .patterns(path) call.
pub fn stdin<I: AsRef<[u8]>>(&mut self, input: I) -> &mut Self {
self.cmd.set_stdin(input.as_ref().to_vec().into_boxed_slice());
self.cmd.stdin(input);
self
}

View File

@ -244,7 +244,7 @@ impl Rustc {
/// Specify a stdin input
pub fn stdin<I: AsRef<[u8]>>(&mut self, input: I) -> &mut Self {
self.cmd.set_stdin(input.as_ref().to_vec().into_boxed_slice());
self.cmd.stdin(input);
self
}

View File

@ -92,7 +92,7 @@ impl Rustdoc {
/// Specify a stdin input
pub fn stdin<I: AsRef<[u8]>>(&mut self, input: I) -> &mut Self {
self.cmd.set_stdin(input.as_ref().to_vec().into_boxed_slice());
self.cmd.stdin(input);
self
}