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 #769.
  • Loading branch information
Alexhuszagh committed Jun 9, 2022
1 parent ee2fc1b commit 4579ed0
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 @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Added

- #771 - fix parsing of `DOCKER_OPTS`.
- #767 - added the `cross-util` and `cross-dev` commands.
- #745 - added `thumbv7neon-*` targets.
- #741 - added `armv7-unknown-linux-gnueabi` and `armv7-unknown-linux-musleabi` targets.
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 4579ed0

Please sign in to comment.