Skip to content

Commit f681392

Browse files
committed
Write stderr output from build-scripts to disk.
Closes #3462
1 parent 9fcdbb4 commit f681392

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/cargo/ops/cargo_rustc/custom_build.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,12 @@ fn build_work<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>)
164164
let pkg_name = unit.pkg.to_string();
165165
let build_state = cx.build_state.clone();
166166
let id = unit.pkg.package_id().clone();
167-
let output_file = build_output.parent().unwrap().join("output");
167+
let (output_file, err_file) = {
168+
let build_output_parent = build_output.parent().unwrap();
169+
let output_file = build_output_parent.join("output");
170+
let err_file = build_output_parent.join("stderr");
171+
(output_file, err_file)
172+
};
168173
let all = (id.clone(), pkg_name.clone(), build_state.clone(),
169174
output_file.clone());
170175
let build_scripts = super::load_build_deps(cx, unit);
@@ -237,7 +242,9 @@ fn build_work<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>)
237242
pkg_name, e.desc);
238243
Human(e)
239244
})?;
245+
240246
paths::write(&output_file, &output.stdout)?;
247+
paths::write(&err_file, &output.stderr)?;
241248

242249
// After the build command has finished running, we need to be sure to
243250
// remember all of its output so we can later discover precisely what it

0 commit comments

Comments
 (0)