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

Don't read stderr into memory when not captured #148

Merged
merged 8 commits into from
Aug 10, 2021
Merged

Don't read stderr into memory when not captured #148

merged 8 commits into from
Aug 10, 2021

Conversation

soenkehahn
Copy link
Owner

Similar to #143. Fixes #26.

Copy link
Collaborator

@casey casey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, minor comment about deduplicating the code, but if you can't see a good way to do it I don't think it should hold this PR up.

memory-tests/src/bin/produce_bytes.rs Show resolved Hide resolved
@@ -54,15 +54,21 @@ impl Waiter {
});
let mut context_clone = context.clone();
let capture_stderr = config.capture_stderr;
let stderr_join_handle = thread::spawn(move || -> io::Result<Vec<u8>> {
let mut collected_stderr = Vec::new();
let stderr_join_handle = thread::spawn(move || -> io::Result<Option<Vec<u8>>> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this could be DRYed up. The code here seems nontrivial, so merging the stdout and stderr capture would be nice.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of 4015e1c?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, looks good.

@soenkehahn soenkehahn enabled auto-merge (squash) August 10, 2021 02:51
@soenkehahn soenkehahn merged commit 75ebef4 into master Aug 10, 2021
@soenkehahn soenkehahn deleted the stderr branch August 10, 2021 03:06
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.

Don't collect stdout and stderr into memory when not needed
2 participants