Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug with_stdin #71

Closed
coreyja opened this issue Mar 21, 2019 · 2 comments
Closed

Possible bug with_stdin #71

coreyja opened this issue Mar 21, 2019 · 2 comments
Labels
bug Not as expected

Comments

@coreyja
Copy link

coreyja commented Mar 21, 2019

I'm running into what I think is a bug with with_stdin, but I also could be misunderstanding the use-case for it!

I have boiled down my usage, to something where I can reproduce with just cat

let mut cmd = Command::new("cat");
cmd
    .with_stdin()
    .buffer("42");
let assert = cmd.assert();
assert
  .success()
  .stdout("42");

I expected this to function kinda like echo 42 | cat which outputs 42

However this assert is not passing for me. Am I misunderstanding something, or is this a bug? I am using version 0.11.0 right now

Thanks for the time, and for writing and maintaining this library!

epage added a commit to epage/assert_cmd that referenced this issue Mar 21, 2019
@epage epage added the bug Not as expected label Mar 21, 2019
@epage
Copy link
Contributor

epage commented Mar 21, 2019

I think this is more of a bug in the documentation than in stdin handling. #72 updates the examples to be

/// ```rust
/// use assert_cmd::prelude::*;
///
/// use std::process::Command;
///
/// let mut cmd = Command::new("cat");
/// cmd
///     .arg("-et");
/// cmd
///     .with_stdin()
///     .buffer("42")
///     .assert()
///     .stdout("42");
/// ```

I will say, this is very unergonomic but I'm at a loss on how to improve it.

@coreyja
Copy link
Author

coreyja commented Mar 21, 2019

Awesome! I will try this out in my project soon with the updated documentation and report back if I run into any issues!

Thanks so much for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not as expected
Projects
None yet
Development

No branches or pull requests

2 participants