Skip to content

Commit 13c31d4

Browse files
committed
update streaming to record its execution via commandprofiler
1 parent 5e0c197 commit 13c31d4

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2576,7 +2576,7 @@ pub fn stream_cargo(
25762576
}
25772577

25782578
// Make sure Cargo actually succeeded after we read all of its stdout.
2579-
let status = t!(streaming_command.wait());
2579+
let status = t!(streaming_command.wait(&builder.config.exec_ctx));
25802580
if builder.is_verbose() && !status.success() {
25812581
eprintln!(
25822582
"command did not execute successfully: {cmd:?}\n\

src/bootstrap/src/utils/exec.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ impl ExecutionContext {
807807

808808
let stdout = child.stdout.take();
809809
let stderr = child.stderr.take();
810-
Some(StreamingCommand { child, stdout, stderr })
810+
Some(StreamingCommand { child, stdout, stderr, fingerprint, start_time })
811811
}
812812
}
813813

@@ -818,8 +818,14 @@ impl AsRef<ExecutionContext> for ExecutionContext {
818818
}
819819

820820
impl StreamingCommand {
821-
pub fn wait(mut self) -> Result<ExitStatus, std::io::Error> {
822-
self.child.wait()
821+
pub fn wait(
822+
mut self,
823+
exec_ctx: impl AsRef<ExecutionContext>,
824+
) -> Result<ExitStatus, std::io::Error> {
825+
let exec_ctx = exec_ctx.as_ref();
826+
let output = self.child.wait();
827+
exec_ctx.profiler().record_execution(self.fingerprint, self.start_time);
828+
output
823829
}
824830
}
825831

src/bootstrap/src/utils/render_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn run_tests(builder: &Builder<'_>, cmd: &mut BootstrapCommand, stream: bool) ->
6363
renderer.render_all();
6464
}
6565

66-
let status = streaming_command.wait().unwrap();
66+
let status = streaming_command.wait(&builder.config.exec_ctx).unwrap();
6767
if !status.success() && builder.is_verbose() {
6868
println!(
6969
"\n\ncommand did not execute successfully: {cmd:?}\n\

0 commit comments

Comments
 (0)