Append to existing RUSTFLAGS, instead of overwriting. (#1582)

* Append to existing RUSTFLAGS, instead of overwriting.

* Assemble RUSTFLAGS correctly.

Co-authored-by: Thomas Kintscher <thomas@flowciety.de>
This commit is contained in:
Thomas Kintscher 2021-12-21 04:12:58 +01:00 committed by GitHub
parent ce572bcee4
commit f0d0f2f2e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,16 +115,16 @@ hint: This command only works in the manifest directory of a Cargo package."#
bail!("`cargo clean` failed with status: {}", check_status);
}
let mut rustflags = env::var("RUSTFLAGS").unwrap_or_default();
rustflags.push_str(&format!(
" --cfg __sqlx_recompile_trigger=\"{}\"",
SystemTime::UNIX_EPOCH.elapsed()?.as_millis()
));
Command::new(&cargo)
.arg("check")
.args(cargo_args)
.env(
"RUSTFLAGS",
format!(
"--cfg __sqlx_recompile_trigger=\"{}\"",
SystemTime::UNIX_EPOCH.elapsed()?.as_millis()
),
)
.env("RUSTFLAGS", rustflags)
.env("SQLX_OFFLINE", "false")
.status()?
} else {