| { | ||
| "git": { | ||
| "sha1": "324a8eab8f8080d3a0938c1c42856d784f42f629" | ||
| "sha1": "9ec00e4bf2a8b087760245b0ec721fb3bd59731f" | ||
| }, | ||
| "path_in_vcs": "" | ||
| } |
+3
-3
@@ -13,3 +13,3 @@ # This file is automatically @generated by Cargo. | ||
| name = "cc" | ||
| version = "1.2.48" | ||
| version = "1.2.49" | ||
| dependencies = [ | ||
@@ -75,5 +75,5 @@ "find-msvc-tools", | ||
| name = "libc" | ||
| version = "0.2.177" | ||
| version = "0.2.178" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" | ||
| checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" | ||
@@ -80,0 +80,0 @@ [[package]] |
+1
-1
@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| name = "cc" | ||
| version = "1.2.48" | ||
| version = "1.2.49" | ||
| authors = ["Alex Crichton <alex@alexcrichton.com>"] | ||
@@ -19,0 +19,0 @@ build = false |
+9
-0
@@ -10,2 +10,11 @@ # Changelog | ||
| ## [1.2.49](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.48...cc-v1.2.49) - 2025-12-06 | ||
| ### Other | ||
| - Fix run_output to prevent infinite blocking ([#1627](https://github.com/rust-lang/cc-rs/pull/1627)) | ||
| - Fix detect_family deadlock ([#1626](https://github.com/rust-lang/cc-rs/pull/1626)) | ||
| - Fix link in new debug_str doc comment ([#1625](https://github.com/rust-lang/cc-rs/pull/1625)) | ||
| - Support more of Cargo's debug levels with Build::debug_str ([#1624](https://github.com/rust-lang/cc-rs/pull/1624)) | ||
| ## [1.2.48](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.47...cc-v1.2.48) - 2025-11-28 | ||
@@ -12,0 +21,0 @@ |
+34
-13
@@ -12,3 +12,3 @@ //! Miscellaneous helpers for running commands | ||
| path::Path, | ||
| process::{Child, ChildStderr, Command, Stdio}, | ||
| process::{Child, ChildStderr, Command, Output, Stdio}, | ||
| sync::{ | ||
@@ -352,20 +352,41 @@ atomic::{AtomicBool, Ordering}, | ||
| pub(crate) fn run_output(cmd: &mut Command, cargo_output: &CargoOutput) -> Result<Vec<u8>, Error> { | ||
| pub(crate) fn spawn_and_wait_for_output( | ||
| cmd: &mut Command, | ||
| cargo_output: &CargoOutput, | ||
| ) -> Result<Output, Error> { | ||
| // We specifically need the output to be captured, so override default | ||
| let mut captured_cargo_output = cargo_output.clone(); | ||
| captured_cargo_output.output = OutputKind::Capture; | ||
| let mut child = spawn(cmd, &captured_cargo_output)?; | ||
| spawn(cmd, &captured_cargo_output)? | ||
| .wait_with_output() | ||
| .map_err(|e| { | ||
| Error::new( | ||
| ErrorKind::ToolExecError, | ||
| format!("failed to wait on spawned child process `{cmd:?}`: {e}"), | ||
| ) | ||
| }) | ||
| } | ||
| let mut stdout = vec![]; | ||
| child | ||
| .stdout | ||
| .take() | ||
| .unwrap() | ||
| .read_to_end(&mut stdout) | ||
| .unwrap(); | ||
| pub(crate) fn run_output(cmd: &mut Command, cargo_output: &CargoOutput) -> Result<Vec<u8>, Error> { | ||
| let Output { | ||
| status, | ||
| stdout, | ||
| stderr, | ||
| } = spawn_and_wait_for_output(cmd, cargo_output)?; | ||
| // Don't care about this output, use the normal settings | ||
| wait_on_child(cmd, &mut child, cargo_output)?; | ||
| stderr | ||
| .split(|&b| b == b'\n') | ||
| .filter(|part| !part.is_empty()) | ||
| .for_each(write_warning); | ||
| Ok(stdout) | ||
| cargo_output.print_debug(&status); | ||
| if status.success() { | ||
| Ok(stdout) | ||
| } else { | ||
| Err(Error::new( | ||
| ErrorKind::ToolExecError, | ||
| format!("command did not execute successfully (status code {status}): {cmd:?}"), | ||
| )) | ||
| } | ||
| } | ||
@@ -372,0 +393,0 @@ |
+44
-20
| use crate::{ | ||
| command_helpers::{run_output, spawn, CargoOutput}, | ||
| command_helpers::{run_output, spawn_and_wait_for_output, CargoOutput}, | ||
| run, | ||
@@ -7,3 +7,2 @@ tempfile::NamedTempfile, | ||
| }; | ||
| use std::io::Read; | ||
| use std::{ | ||
@@ -16,3 +15,3 @@ borrow::Cow, | ||
| path::{Path, PathBuf}, | ||
| process::{Command, Stdio}, | ||
| process::{Command, Output, Stdio}, | ||
| sync::RwLock, | ||
@@ -227,14 +226,10 @@ }; | ||
| let mut captured_cargo_output = compiler_detect_output.clone(); | ||
| captured_cargo_output.output = OutputKind::Capture; | ||
| captured_cargo_output.warnings = true; | ||
| let mut child = spawn(&mut cmd, &captured_cargo_output)?; | ||
| let Output { | ||
| status, | ||
| stdout, | ||
| stderr, | ||
| } = spawn_and_wait_for_output(&mut cmd, &captured_cargo_output)?; | ||
| let mut out = vec![]; | ||
| let mut err = vec![]; | ||
| child.stdout.take().unwrap().read_to_end(&mut out)?; | ||
| child.stderr.take().unwrap().read_to_end(&mut err)?; | ||
| let status = child.wait()?; | ||
| let stdout = if [&out, &err] | ||
| let stdout = if [&stdout, &stderr] | ||
| .iter() | ||
@@ -257,3 +252,3 @@ .any(|o| String::from_utf8_lossy(o).contains("-Wslash-u-filename")) | ||
| out | ||
| stdout | ||
| }; | ||
@@ -516,3 +511,8 @@ | ||
| /// What the flag to request debug info for this family of tools look like | ||
| pub(crate) fn add_debug_flags(&self, cmd: &mut Tool, dwarf_version: Option<u32>) { | ||
| pub(crate) fn add_debug_flags( | ||
| &self, | ||
| cmd: &mut Tool, | ||
| debug_opt: &str, | ||
| dwarf_version: Option<u32>, | ||
| ) { | ||
| match *self { | ||
@@ -523,7 +523,31 @@ ToolFamily::Msvc { .. } => { | ||
| ToolFamily::Gnu | ToolFamily::Clang { .. } => { | ||
| cmd.push_cc_arg( | ||
| dwarf_version | ||
| .map_or_else(|| "-g".into(), |v| format!("-gdwarf-{v}")) | ||
| .into(), | ||
| ); | ||
| match debug_opt { | ||
| // From https://doc.rust-lang.org/cargo/reference/profiles.html#debug | ||
| "" | "0" | "false" | "none" => { | ||
| debug_assert!( | ||
| false, | ||
| "earlier check should have avoided calling add_debug_flags" | ||
| ); | ||
| } | ||
| // line-directives-only is LLVM-specific; for GCC we have to treat it like "1" | ||
| "line-directives-only" if cmd.is_like_clang() => { | ||
| cmd.push_cc_arg("-gline-directives-only".into()); | ||
| } | ||
| // Clang has -gline-tables-only, but it's an alias for -g1 anyway. | ||
| // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-gline-tables-only | ||
| "1" | "limited" | "line-tables-only" | "line-directives-only" => { | ||
| cmd.push_cc_arg("-g1".into()); | ||
| } | ||
| "2" | "true" | "full" => { | ||
| cmd.push_cc_arg("-g".into()); | ||
| } | ||
| _ => { | ||
| // Err on the side of including too much info rather than too little. | ||
| cmd.push_cc_arg("-g".into()); | ||
| } | ||
| } | ||
| if let Some(v) = dwarf_version { | ||
| cmd.push_cc_arg(format!("-gdwarf-{v}").into()); | ||
| } | ||
| } | ||
@@ -530,0 +554,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display