From d44a108804ba7b7b91c3feeb0f92f12e9a3c019b Mon Sep 17 00:00:00 2001 From: "Eric B. Ridge" Date: Mon, 18 Dec 2023 09:06:52 -0500 Subject: [PATCH] Handle RUSTFLAGS better 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); } }