| Index: runtime/bin/process_patch.dart
|
| diff --git a/runtime/bin/process_patch.dart b/runtime/bin/process_patch.dart
|
| index b30f449c7d014efa3d7965d73ad03cab902fb67e..65d271f0a1f447cc2786647413181183d62f9790 100644
|
| --- a/runtime/bin/process_patch.dart
|
| +++ b/runtime/bin/process_patch.dart
|
| @@ -20,11 +20,13 @@ patch class Process {
|
| List<String> arguments,
|
| {String workingDirectory,
|
| Map<String, String> environment,
|
| - bool runInShell}) {
|
| + bool includeParentEnvironment: true,
|
| + bool runInShell: false}) {
|
| _ProcessImpl process = new _ProcessImpl(executable,
|
| arguments,
|
| workingDirectory,
|
| environment,
|
| + includeParentEnvironment,
|
| runInShell);
|
| return process._start();
|
| }
|
| @@ -34,13 +36,15 @@ patch class Process {
|
| List<String> arguments,
|
| {String workingDirectory,
|
| Map<String, String> environment,
|
| - bool runInShell,
|
| + bool includeParentEnvironment: true,
|
| + bool runInShell: false,
|
| Encoding stdoutEncoding: Encoding.SYSTEM,
|
| Encoding stderrEncoding: Encoding.SYSTEM}) {
|
| return _runNonInteractiveProcess(executable,
|
| arguments,
|
| workingDirectory,
|
| environment,
|
| + includeParentEnvironment,
|
| runInShell,
|
| stdoutEncoding,
|
| stderrEncoding);
|
| @@ -68,6 +72,7 @@ class _ProcessImpl extends NativeFieldWrapperClass1 implements Process {
|
| List<String> arguments,
|
| String this._workingDirectory,
|
| Map<String, String> environment,
|
| + bool includeParentEnvironment,
|
| bool runInShell) {
|
| runInShell = identical(runInShell, true);
|
| if (runInShell) {
|
| @@ -101,20 +106,23 @@ class _ProcessImpl extends NativeFieldWrapperClass1 implements Process {
|
| "WorkingDirectory is not a String: $_workingDirectory");
|
| }
|
|
|
| - if (environment != null) {
|
| - var env = environment;
|
| - if (env is !Map) {
|
| - throw new ArgumentError("Environment is not a map: $env");
|
| - }
|
| - _environment = [];
|
| - env.forEach((key, value) {
|
| - if (key is !String || value is !String) {
|
| - throw new ArgumentError(
|
| - "Environment key or value is not a string: ($key, $value)");
|
| - }
|
| - _environment.add('$key=$value');
|
| - });
|
| + _environment = [];
|
| + if (environment == null) {
|
| + environment = {};
|
| + }
|
| + if (environment is !Map) {
|
| + throw new ArgumentError("Environment is not a map: $environment");
|
| }
|
| + if (identical(true, includeParentEnvironment)) {
|
| + environment = Platform.environment..addAll(environment);
|
| + }
|
| + environment.forEach((key, value) {
|
| + if (key is !String || value is !String) {
|
| + throw new ArgumentError(
|
| + "Environment key or value is not a string: ($key, $value)");
|
| + }
|
| + _environment.add('$key=$value');
|
| + });
|
|
|
| // stdin going to process.
|
| _stdin = new _StdSink(new _Socket._writePipe());
|
| @@ -331,6 +339,7 @@ Future<ProcessResult> _runNonInteractiveProcess(String path,
|
| List<String> arguments,
|
| String workingDirectory,
|
| Map<String, String> environment,
|
| + bool includeParentEnvironment,
|
| bool runInShell,
|
| Encoding stdoutEncoding,
|
| Encoding stderrEncoding) {
|
| @@ -339,6 +348,7 @@ Future<ProcessResult> _runNonInteractiveProcess(String path,
|
| arguments,
|
| workingDirectory: workingDirectory,
|
| environment: environment,
|
| + includeParentEnvironment: includeParentEnvironment,
|
| runInShell: runInShell).then((Process p) {
|
| int pid = p.pid;
|
|
|
|
|