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

feat: Added wait method on FfmpegChild #14

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

emirror-de
Copy link
Contributor

Every call to spawn without a call on the Result to wait results in a zombie process that stays until the main thread exits. This lead to OS issues with large datasets because it is possible that all PID's are used by the zombies.

This PR exposes the wait method of std::process::Child to the user, giving the possibility to wait for the process to complete and clean up properly.

It has only been tested on Linux.

I am happy to further adjust the code to your coding/documentation style requirements.

Best regards,
Lewin

@nathanbabcock
Copy link
Owner

Thank you for the PR Lewin 🙏

I tested this branch on Windows and it works for me.

One thing to keep in mind: There is an additional escape hatch on FfmpegChild -- by using the methods as_inner() and as_inner_mut() you can access any method on the inner std::Child instance. Having said that, I like the fact that your change makes the wait method even more easily accessible, and that the comment on spawn() calls attention to a behavior which might otherwise be overlooked. as_inner_mut() can still be used for really uncommon situations like maybe accessing the Child id(), or calling try_wait(), or something else like that.

LGTM! 👍

@nathanbabcock nathanbabcock merged commit 232301f into nathanbabcock:main Apr 25, 2023
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

Successfully merging this pull request may close these issues.

2 participants