Chromium Code Reviews| Index: runtime/bin/process_impl.dart |
| diff --git a/runtime/bin/process_impl.dart b/runtime/bin/process_impl.dart |
| index 1ff6de99539345007a73cb90a160aaaf6da46bd0..ec63cac52eb22e8e6842ebee31e9a83822733b2a 100644 |
| --- a/runtime/bin/process_impl.dart |
| +++ b/runtime/bin/process_impl.dart |
| @@ -68,6 +68,21 @@ class _InteractiveProcess implements Process { |
| } |
| } |
| + if (options !== null && options.environment !== null) { |
| + var env = options.environment; |
| + if (env is !Map) { |
| + throw new IllegalArgumentException("Environment is not a map: $env"); |
| + } |
| + _environment = []; |
| + env.forEach((key, value) { |
| + if (key is !String || value is !String) { |
|
Søren Gjesse
2012/04/19 12:45:55
Maybe we should allow any type on value and just r
Søren Gjesse
2012/04/19 12:45:55
Check that the key does not contain illegal charct
Søren Gjesse
2012/04/19 12:45:55
For both key and value.toString() is there any cha
Mads Ager (google)
2012/04/20 12:24:51
I would like to start out requiring this to be a M
Mads Ager (google)
2012/04/20 12:24:51
An early check for that would make sense, thanks.
Mads Ager (google)
2012/04/20 12:24:51
Yes, at this point if you go out of ASCII range th
|
| + throw new IllegalArgumentException( |
| + "Environment key or value is not a string: ($key, $value)"); |
| + } |
| + _environment.add('$key=$value'); |
| + }); |
| + } |
| + |
| _in = new _Socket._internalReadOnly(); // stdout coming from process. |
| _out = new _Socket._internalWriteOnly(); // stdin going to process. |
| _err = new _Socket._internalReadOnly(); // stderr coming from process. |
| @@ -139,6 +154,7 @@ class _InteractiveProcess implements Process { |
| bool success = _start(_path, |
| _arguments, |
| _workingDirectory, |
| + _environment, |
| _in, |
| _out, |
| _err, |
| @@ -192,6 +208,7 @@ class _InteractiveProcess implements Process { |
| bool _start(String path, |
| List<String> arguments, |
| String workingDirectory, |
| + List<String> environment, |
| Socket input, |
| Socket output, |
| Socket error, |
| @@ -274,6 +291,7 @@ class _InteractiveProcess implements Process { |
| String _path; |
| ObjectArray<String> _arguments; |
| String _workingDirectory; |
| + List<String> _environment; |
| // Private methods of _Socket are used by _in, _out, and _err. |
| _Socket _in; |
| _Socket _out; |