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

Move stream_output to ProcessBuilder #3091

Merged
merged 1 commit into from
Sep 26, 2016

Conversation

matklad
Copy link
Member

@matklad matklad commented Sep 14, 2016

Make stream_output method more reusable (I intend to use it in #3000).

Unrelated question: what is that ExecEngine thing? Looks like it does nothing at the moment and can be removed.

@rust-highfive
Copy link

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

}));
child.wait()
})().map_err(|e| {
process_error(&format!("Could not execute process `{}`",
Copy link
Member

Choose a reason for hiding this comment

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

Could this start w/ a lowercase c (to mesh with Cargo's other error messages)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll change other messages in this file to lowecase as well.

status: status,
};
if !output.status.success() {
Err(process_error(&format!("Process didn't exit successfully: `{}`",
Copy link
Member

Choose a reason for hiding this comment

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

(same here as above)

@@ -107,6 +107,63 @@ impl ProcessBuilder {
}
}

pub fn exec_with_streaming<F1, F2>(&self, mut on_stdout_line: F1, mut on_stderr_line: F2)
-> Result<Output, ProcessError>
where F1: FnMut(&str), F2: FnMut(&str)
Copy link
Member

Choose a reason for hiding this comment

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

For big functions like this I tend to try to keep them concrete (to avoid codegen bloat), perhaps these could both be &mut FnMut(&str) as arguments?

@matklad matklad force-pushed the move-exec-streamed branch 5 times, most recently from 79a77b0 to 4f8975b Compare September 15, 2016 13:47
@matklad
Copy link
Member Author

matklad commented Sep 15, 2016

Should be OK now, Travis fails because of the stalled build.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Sep 26, 2016

📌 Commit 5eb80b7 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Sep 26, 2016

⌛ Testing commit 5eb80b7 with merge 4f57637...

bors added a commit that referenced this pull request Sep 26, 2016
Move stream_output to ProcessBuilder

Make `stream_output` method more reusable (I intend to use it in #3000).

Unrelated question: what is that `ExecEngine` thing? Looks like it does nothing at the moment and can be removed.
@bors
Copy link
Contributor

bors commented Sep 26, 2016

☀️ Test successful - cargo-cross-linux, cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-gnu-64, cargo-win-msvc-32, cargo-win-msvc-64
Approved by: alexcrichton
Pushing 4f57637 to master...

@bors bors merged commit 5eb80b7 into rust-lang:master Sep 26, 2016
@matklad matklad deleted the move-exec-streamed branch December 14, 2016 15:27
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.

4 participants