about summary refs log tree commit diff
path: root/src/librustuv
diff options
context:
space:
mode:
authorAaron Turon <aturon@mozilla.com>2014-07-02 13:50:45 -0700
committerAaron Turon <aturon@mozilla.com>2014-07-10 12:16:16 -0700
commitbfa853f8ed45d1908c98ec350f52c7a6790661da (patch)
tree96c101298ae0503bd64bb51201e2154eeb88d905 /src/librustuv
parentf9fe251777e9f1cc557a6d5b82b45403935d0a10 (diff)
downloadrust-bfa853f8ed45d1908c98ec350f52c7a6790661da.tar.gz
rust-bfa853f8ed45d1908c98ec350f52c7a6790661da.zip
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]
Diffstat (limited to 'src/librustuv')
-rw-r--r--src/librustuv/process.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustuv/process.rs b/src/librustuv/process.rs
index 61325d0ce94..0486f376bc8 100644
--- a/src/librustuv/process.rs
+++ b/src/librustuv/process.rs
@@ -193,7 +193,7 @@ fn with_argv<T>(prog: &CString, args: &[CString],
 }
 
 /// Converts the environment to the env array expected by libuv
-fn with_env<T>(env: Option<&[(CString, CString)]>,
+fn with_env<T>(env: Option<&[(&CString, &CString)]>,
                cb: |*const *const libc::c_char| -> T) -> T {
     // We can pass a char** for envp, which is a null-terminated array
     // of "k=v\0" strings. Since we must create these strings locally,