From ac72c31fa0b63b8aba56ec40bacd3e9492df4f1f Mon Sep 17 00:00:00 2001 From: konstin Date: Wed, 21 Aug 2024 22:31:47 +0200 Subject: [PATCH] Forward `cargo package --list` warnings --- src/source_distribution.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/source_distribution.rs b/src/source_distribution.rs index 6f8e8ded0..5dcd370fc 100644 --- a/src/source_distribution.rs +++ b/src/source_distribution.rs @@ -8,6 +8,7 @@ use ignore::overrides::Override; use normpath::PathExt as _; use path_slash::PathExt as _; use std::collections::HashMap; +use std::io::Write; use std::path::{Path, PathBuf}; use std::process::Command; use std::str; @@ -153,8 +154,9 @@ fn add_crate_to_source_distribution( skip_cargo_toml: bool, ) -> Result<()> { let manifest_path = manifest_path.as_ref(); + let args = ["package", "--list", "--allow-dirty", "--manifest-path"]; let output = Command::new("cargo") - .args(["package", "--list", "--allow-dirty", "--manifest-path"]) + .args(args) .arg(manifest_path) .output() .with_context(|| { @@ -172,6 +174,10 @@ fn add_crate_to_source_distribution( String::from_utf8_lossy(&output.stderr), ); } + if !output.stderr.is_empty() { + eprintln!("From `cargo {}`:", args.join(" ")); + std::io::stderr().write_all(&output.stderr)?; + } let file_list: Vec<&Path> = str::from_utf8(&output.stdout) .context("Cargo printed invalid utf-8 ಠ_ಠ")?