Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
io::process::Command: add fine-grained env builder
This commit changes the `io::process::Command` API to provide fine-grained control over the environment: * The `env` method now inserts/updates a key/value pair. * The `env_remove` method removes a key from the environment. * The old `env` method, which sets the entire environment in one shot, is renamed to `env_set_all`. It can be used in conjunction with the finer-grained methods. This renaming is a breaking change. To support these new methods, the internal `env` representation for `Command` has been changed to an optional `HashMap` holding owned `CString`s (to support non-utf8 data). The `HashMap` is only materialized if the environment is updated. The implementation does not try hard to avoid allocation, since the cost of launching a process will dwarf any allocation cost. This patch also adds `PartialOrd`, `Eq`, and `Hash` implementations for `CString`. [breaking-change]
- Loading branch information
Showing
11 changed files
with
138 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
bfa853f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from alexcrichton
at aturon@bfa853f
bfa853f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging aturon/rust/env-hashmap = bfa853f into auto
bfa853f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aturon/rust/env-hashmap = bfa853f merged ok, testing candidate = a672456
bfa853f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/272
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/273
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/272
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/273
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/275
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/276
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/275
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/281
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/276
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/275
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/278
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/276
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/276
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/277
bfa853f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = a672456