Skip to content

Commit

Permalink
Append to existing RUSTFLAGS, instead of overwriting. (#1582)
Browse files Browse the repository at this point in the history
* Append to existing RUSTFLAGS, instead of overwriting.

* Assemble RUSTFLAGS correctly.

Co-authored-by: Thomas Kintscher <[email protected]>
  • Loading branch information
tkintscher and Thomas Kintscher authored Dec 21, 2021
1 parent ce572bc commit f0d0f2f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sqlx-cli/src/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f0d0f2f

Please sign in to comment.