From f6c032e93ac258e514cfaa26509f2f8752631322 Mon Sep 17 00:00:00 2001 From: Eric Ridge Date: Mon, 18 Dec 2023 09:28:40 -0500 Subject: [PATCH] Handle RUSTFLAGS better (#1441) This cleans up PR #1435 as per (https://github.com/pgcentralfoundation/pgrx/pull/1435#issuecomment-1859360044). What we probably really want is a legit "RUSTFLAGS" parser. I don't feel like writing and testing one and a quick search didn't find anything on crates.io. So splitting on whitespace will have to be Good Enough. --- cargo-pgrx/src/command/schema.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cargo-pgrx/src/command/schema.rs b/cargo-pgrx/src/command/schema.rs index 44a4d48a5..fa206c24b 100644 --- a/cargo-pgrx/src/command/schema.rs +++ b/cargo-pgrx/src/command/schema.rs @@ -526,8 +526,8 @@ fn create_stub( so_rustc_invocation.stderr(Stdio::inherit()); if let Ok(rustc_flags_str) = std::env::var("RUSTFLAGS") { - if !rustc_flags_str.trim().is_empty() { - let rustc_flags = rustc_flags_str.split(' ').collect::>(); + let rustc_flags = rustc_flags_str.split_whitespace().collect::>(); + if !rustc_flags.is_empty() { so_rustc_invocation.args(rustc_flags); } }