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

Unified Diff: utils/pub/io.dart

Issue 11343059: Configure git explicitly when committing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 | « no previous file | utils/tests/pub/test_pub.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/io.dart
diff --git a/utils/pub/io.dart b/utils/pub/io.dart
index c2f14568906fd92033c75fdd9e71d1b2c4990d43..13de28191687c4a2eb180b05de6a09d771336c05 100644
--- a/utils/pub/io.dart
+++ b/utils/pub/io.dart
@@ -471,15 +471,17 @@ Future<List<int>> consumeInputStream(InputStream stream) {
return completer.future;
}
-/**
- * Spawns and runs the process located at [executable], passing in [args].
- * Returns a [Future] that will complete the results of the process after it
- * has ended.
- *
- * If [pipeStdout] and/or [pipeStderr] are set, all output from the subprocess's
- * output streams are sent to the parent process's output streams. Output from
- * piped streams won't be available in the result object.
- */
+/// Spawns and runs the process located at [executable], passing in [args].
+/// Returns a [Future] that will complete the results of the process after it
+/// has ended.
+///
+/// The spawned process will inherit its parents environment variables. If
nweiz 2012/10/30 23:29:59 "parents" -> "parent's"
Bob Nystrom 2012/10/30 23:31:42 Done.
+/// [environment] is provided, that will be used to augment (not replace) the
+/// the inherited variables.
+///
+/// If [pipeStdout] and/or [pipeStderr] are set, all output from the
+/// subprocess's output streams are sent to the parent process's output streams.
+/// Output from piped streams won't be available in the result object.
Future<PubProcessResult> runProcess(String executable, List<String> args,
{workingDir, Map<String, String> environment, bool pipeStdout: false,
bool pipeStderr: false}) {
@@ -499,7 +501,11 @@ Future<PubProcessResult> runProcess(String executable, List<String> args,
if (workingDir != null) {
options.workingDirectory = _getDirectory(workingDir).path;
}
- options.environment = environment;
+
+ if (environment != null) {
+ options.environment = new Map.from(Platform.environment);
+ environment.forEach((key, value) => options.environment[key] = value);
+ }
var future = Process.run(executable, args, options);
return future.transform((result) {
@@ -556,8 +562,11 @@ Future<bool> get isGitInstalled {
}
/// Run a git process with [args] from [workingDir].
-Future<PubProcessResult> runGit(List<String> args, {String workingDir}) =>
- _gitCommand.chain((git) => runProcess(git, args, workingDir: workingDir));
+Future<PubProcessResult> runGit(List<String> args,
+ {String workingDir, Map<String, String> environment}) {
+ return _gitCommand.chain((git) => runProcess(git, args,
+ workingDir: workingDir, environment: environment));
+}
/// Returns the name of the git command-line app, or null if Git could not be
/// found on the user's PATH.
« no previous file with comments | « no previous file | utils/tests/pub/test_pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698