Skip to content

Commit 1bed083

Browse files
committed
[DO NOT MERGE] verbose print build_helper stdout
1 parent fb95f00 commit 1bed083

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/build_helper/src/git.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::path::{Path, PathBuf};
2-
use std::process::{Command, Stdio};
2+
use std::process::Command;
33

44
use crate::ci::CiEnv;
55

@@ -11,11 +11,14 @@ pub struct GitConfig<'a> {
1111

1212
/// Runs a command and returns the output
1313
pub fn output_result(cmd: &mut Command) -> Result<String, String> {
14-
let output = match cmd.stderr(Stdio::inherit()).output() {
14+
let output = match cmd.output() {
1515
Ok(status) => status,
1616
Err(e) => return Err(format!("failed to run command: {:?}: {}", cmd, e)),
1717
};
1818
if !output.status.success() {
19+
eprintln!("[DEBUG] stdout:\n{}\n\n", String::from_utf8(output.stdout.clone()).unwrap());
20+
eprintln!("[DEBUG] stderr:\n{}\n\n", String::from_utf8(output.stderr.clone()).unwrap());
21+
1922
return Err(format!(
2023
"command did not execute successfully: {:?}\n\
2124
expected success, got: {}\n{}",
@@ -107,8 +110,10 @@ fn git_upstream_merge_base(
107110
git_dir: Option<&Path>,
108111
) -> Result<String, String> {
109112
let updated_master = updated_master_branch(config, git_dir)?;
113+
eprintln!("updated_master = {:?}", updated_master);
110114
let mut git = Command::new("git");
111115
if let Some(git_dir) = git_dir {
116+
eprintln!("git_dir = {:?}", git_dir);
112117
git.current_dir(git_dir);
113118
}
114119
Ok(output_result(git.arg("merge-base").arg(&updated_master).arg("HEAD"))?.trim().to_owned())
@@ -131,7 +136,10 @@ pub fn get_closest_merge_commit(
131136

132137
let merge_base = {
133138
if CiEnv::is_ci() {
134-
git_upstream_merge_base(config, git_dir).unwrap()
139+
match git_upstream_merge_base(config, git_dir) {
140+
Ok(b) => b,
141+
Err(e) => { eprintln!("merge_base failed: {e}"); return Err(e); }
142+
}
135143
} else {
136144
// For non-CI environments, ignore rust-lang/rust upstream as it usually gets
137145
// outdated very quickly.

0 commit comments

Comments
 (0)