Skip to content

Commit 5efcc2a

Browse files
committed
chore: Added tracing span for build script execution
1 parent 0b3a76f commit 5efcc2a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/cargo/core/compiler/custom_build.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,9 @@ fn build_work(build_runner: &mut BuildRunner<'_, '_>, unit: &Unit) -> CargoResul
564564
let timestamp = paths::set_invocation_time(&script_run_dir)?;
565565
let prefix = format!("[{} {}] ", id.name(), id.version());
566566
let mut log_messages_in_case_of_panic = Vec::new();
567-
let output = cmd
568-
.exec_with_streaming(
567+
let span = tracing::debug_span!("build_script", process = cmd.to_string());
568+
let output = span.in_scope(|| {
569+
cmd.exec_with_streaming(
569570
&mut |stdout| {
570571
if let Some(error) = stdout.strip_prefix(CARGO_ERROR_SYNTAX) {
571572
log_messages_in_case_of_panic.push((Severity::Error, error.to_owned()));
@@ -612,7 +613,8 @@ fn build_work(build_runner: &mut BuildRunner<'_, '_>, unit: &Unit) -> CargoResul
612613
}
613614

614615
build_error_context
615-
});
616+
})
617+
});
616618

617619
// If the build failed
618620
if let Err(error) = output {

0 commit comments

Comments
 (0)