Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep environment variables in a BTreeMap to preserve sort order #7877

Merged
merged 1 commit into from
Feb 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/cargo/util/process_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::util::{process_error, read2, CargoResult, CargoResultExt};
use anyhow::bail;
use jobserver::Client;
use shell_escape::escape;
use std::collections::HashMap;
use std::collections::BTreeMap;
use std::env;
use std::ffi::{OsStr, OsString};
use std::fmt;
Expand All @@ -17,7 +17,7 @@ pub struct ProcessBuilder {
/// A list of arguments to pass to the program.
args: Vec<OsString>,
/// Any environment variables that should be set for the program.
env: HashMap<String, Option<OsString>>,
env: BTreeMap<String, Option<OsString>>,
/// The directory to run the program from.
cwd: Option<OsString>,
/// The `make` jobserver. See the [jobserver crate][jobserver_docs] for
Expand Down Expand Up @@ -128,7 +128,7 @@ impl ProcessBuilder {

/// Gets all environment variables explicitly set or unset for the process (not inherited
/// vars).
pub fn get_envs(&self) -> &HashMap<String, Option<OsString>> {
pub fn get_envs(&self) -> &BTreeMap<String, Option<OsString>> {
&self.env
}

Expand Down Expand Up @@ -334,7 +334,7 @@ pub fn process<T: AsRef<OsStr>>(cmd: T) -> ProcessBuilder {
program: cmd.as_ref().to_os_string(),
args: Vec::new(),
cwd: None,
env: HashMap::new(),
env: BTreeMap::new(),
jobserver: None,
display_env_vars: false,
}
Expand Down