Skip to content

Commit

Permalink
Fix parsing of docker options.
Browse files Browse the repository at this point in the history
Fix parsing `DOCKER_OPTS` to correctly parse them as shell words, rather
than splitting on whitespace.

Closes cross-rs#769.
  • Loading branch information
Alexhuszagh committed Jun 9, 2022
1 parent ee2fc1b commit 06c944d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- #771 - fix parsing of `DOCKER_OPTS`.
- #727 - add `PKG_CONFIG_PATH` to all `*-linux-gnu` images.
- #722 - boolean environment variables are evaluated as truthy or falsey.
- #720 - add android runner to preload `libc++_shared.so`.
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_yaml = { version = "0.8", optional = true }
serde_ignored = "0.1.2"
shell-words = "1.1.0"

[target.'cfg(not(windows))'.dependencies]
nix = { version = "0.24", default-features = false, features = ["user"] }
Expand Down
3 changes: 2 additions & 1 deletion src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ pub fn run(
}

if let Ok(value) = env::var("DOCKER_OPTS") {
let opts: Vec<&str> = value.split(' ').collect();
let opts = shell_words::split(&value)
.wrap_err_with(|| format!("could not pass docker opts of {}", value))?;
docker.args(&opts);
}

Expand Down

0 comments on commit 06c944d

Please sign in to comment.