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

How to ignore non-zero exit status? #94

Closed
Boscop opened this issue Apr 12, 2021 · 3 comments
Closed

How to ignore non-zero exit status? #94

Boscop opened this issue Apr 12, 2021 · 3 comments

Comments

@Boscop
Copy link

Boscop commented Apr 12, 2021

  1. ffmpeg -list_devices true -f dshow -i dummy always returns 1, even though it prints the desired output:
    https://trac.ffmpeg.org/wiki/DirectShow

I'm calling duct like this:

let output = cmd!("ffmpeg", "-list_devices", "true", "-f", "dshow", "-i", "dummy")
	.stdout_stderr_swap() // temp workaround (see below)
	.read()?;

duct fails with:

Error:
    command ["ffmpeg", "-list_devices", "true", "-f", "dshow", "-i", "dummy"] exited with code 1

Thus not returning the output that I want to parse.

How can I get the output, regardless of exit status?


  1. Btw, ffmpeg prints the output in stderr always, to keep stdout for piping video out. (It prints errors to ffmpeg.log). What's the closest to a .read() equivalent for stderr? :)
@Boscop
Copy link
Author

Boscop commented Apr 12, 2021

Ah, just found the unchecked method -.-

@oconnor663
Copy link
Owner

Yep, unchecked. If you're interested in stderr output, it's easier to stop using the read helper method and go back to the more general run function, with something like .stdout_capture().stderr_capture().run(). Let me know if you have any feedback on this part of the API.

@azzamsa
Copy link

azzamsa commented Apr 2, 2023

@Boscop I think it is safe to close this issue for now.

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

No branches or pull requests

3 participants