Skip to content

Commit

Permalink
Add proper deprecation marker
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Jun 27, 2023
1 parent e6868a9 commit 9ab270b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ mod spawn;
pub use crate::cargo::{get_cargo_bin, get_cargo_example};
pub use crate::spawn::{Spawn, SpawnExt};

#[deprecated = "Use .pass_stdin(...) instead"]
#[allow(deprecated)]
pub use crate::spawn::StdinCommand;

pub use std::process::Command;
Expand Down
5 changes: 5 additions & 0 deletions src/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,13 @@ impl<'a> Spawn for &'a mut Command {
}

/// Like [`Command`] but sends some input to stdin.
#[deprecated = "Use .pass_stdin(...) instead"]
pub struct StdinCommand {
command: Command,
stdin: Vec<u8>,
}

#[allow(deprecated)]
impl StdinCommand {
/// Creates a new command that also gets some input value fed to stdin.
pub fn new<S: AsRef<OsStr>, I: Into<Vec<u8>>>(program: S, stdin: I) -> StdinCommand {
Expand All @@ -132,6 +134,7 @@ impl StdinCommand {
}
}

#[allow(deprecated)]
impl Deref for StdinCommand {
type Target = Command;

Expand All @@ -140,12 +143,14 @@ impl Deref for StdinCommand {
}
}

#[allow(deprecated)]
impl DerefMut for StdinCommand {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.command
}
}

#[allow(deprecated)]
impl Spawn for StdinCommand {
fn spawn_with_info(&mut self, stdin: Option<Vec<u8>>) -> (Info, Output) {
Command::spawn_with_info(
Expand Down

0 comments on commit 9ab270b

Please sign in to comment.