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

String support #60

Closed
fernandobatels opened this issue Nov 20, 2018 · 3 comments
Closed

String support #60

fernandobatels opened this issue Nov 20, 2018 · 3 comments
Labels
bug Not as expected

Comments

@fernandobatels
Copy link

Hi, maybe is a my mistake, but i cant use the String type with 'stdout', only the str type.

    let mut main = Command::main_binary().unwrap();

    main.arg("tags")
        .arg("list")
        .arg("--use-csv");

    let stdout = String::from("\"Name\",\"#id\"");

    // stdout.push_str ....
    // stdout.push_str ....
    // stdout.push_str ....
  
    main.assert()
        .success()
        .stdout(stdout.as_str());

On run this, i receive error[E0597]: stdout does not live long enough. I cant use .stdout(stdout.as_str());, because i receive the trait assert_cmd::assert::IntoOutputPredicate<_> is not implemented for std::string::String.

Where am I going wrong :( ?

Thank you in advance for your attention.

@epage epage added the bug Not as expected label Nov 21, 2018
@epage
Copy link
Contributor

epage commented Nov 21, 2018

Overlooked this, sorry. Preparing a fix.

On a related note, I'm not sure why I made the predicate store a Cow<'static, str> rather than allowing more flexible borrows. I'm holding off on addressing that because it'll take more investigation.

@epage
Copy link
Contributor

epage commented Nov 21, 2018

Oh and this could have been worked around by constructing the predicates but that is also a bit more work :)

@fernandobatels
Copy link
Author

fernandobatels commented Nov 22, 2018

Thank you very much, the new version(v0.10.2) fix the problem. :)

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