Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Unified Diff: runtime/bin/process_impl.dart

Issue 10166029: Support passing an environment variable map to child processes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/process.dart ('k') | runtime/bin/process_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/process_impl.dart
diff --git a/runtime/bin/process_impl.dart b/runtime/bin/process_impl.dart
index 1ff6de99539345007a73cb90a160aaaf6da46bd0..bb722500b51370f3da49b0102b8bcbcb3c9a8e57 100644
--- a/runtime/bin/process_impl.dart
+++ b/runtime/bin/process_impl.dart
@@ -68,6 +68,25 @@ 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) {
+ throw new IllegalArgumentException(
+ "Environment key or value is not a string: ($key, $value)");
+ }
+ if (key.contains('=')) {
+ throw new IllegalArgumentException(
+ "Environment keys may not contain '=': $key");
+ }
+ _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 +158,7 @@ class _InteractiveProcess implements Process {
bool success = _start(_path,
_arguments,
_workingDirectory,
+ _environment,
_in,
_out,
_err,
@@ -192,6 +212,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 +295,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;
« no previous file with comments | « runtime/bin/process.dart ('k') | runtime/bin/process_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698