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

Side by Side Diff: utils/pub/io.dart

Issue 11090016: Change core lib, dart2js, and more for new optional parameters syntax (Closed) Base URL: http://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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/pub/hosted_source.dart ('k') | utils/pub/source.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Helper functionality to make working with IO easier. 6 * Helper functionality to make working with IO easier.
7 */ 7 */
8 library io; 8 library io;
9 9
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 /** 474 /**
475 * Spawns and runs the process located at [executable], passing in [args]. 475 * Spawns and runs the process located at [executable], passing in [args].
476 * Returns a [Future] that will complete the results of the process after it 476 * Returns a [Future] that will complete the results of the process after it
477 * has ended. 477 * has ended.
478 * 478 *
479 * If [pipeStdout] and/or [pipeStderr] are set, all output from the subprocess's 479 * If [pipeStdout] and/or [pipeStderr] are set, all output from the subprocess's
480 * output streams are sent to the parent process's output streams. Output from 480 * output streams are sent to the parent process's output streams. Output from
481 * piped streams won't be available in the result object. 481 * piped streams won't be available in the result object.
482 */ 482 */
483 Future<PubProcessResult> runProcess(String executable, List<String> args, 483 Future<PubProcessResult> runProcess(String executable, List<String> args,
484 [workingDir, Map<String, String> environment, bool pipeStdout = false, 484 {workingDir, Map<String, String> environment, bool pipeStdout: false,
485 bool pipeStderr = false]) { 485 bool pipeStderr: false}) {
486 int exitCode; 486 int exitCode;
487 487
488 // TODO(rnystrom): Should dart:io just handle this? 488 // TODO(rnystrom): Should dart:io just handle this?
489 // Spawning a process on Windows will not look for the executable in the 489 // Spawning a process on Windows will not look for the executable in the
490 // system path. So, if executable looks like it needs that (i.e. it doesn't 490 // system path. So, if executable looks like it needs that (i.e. it doesn't
491 // have any path separators in it), then spawn it through a shell. 491 // have any path separators in it), then spawn it through a shell.
492 if ((Platform.operatingSystem == "windows") && 492 if ((Platform.operatingSystem == "windows") &&
493 (executable.indexOf('\\') == -1)) { 493 (executable.indexOf('\\') == -1)) {
494 args = flatten(["/c", executable, args]); 494 args = flatten(["/c", executable, args]);
495 executable = "cmd"; 495 executable = "cmd";
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 if (_isGitInstalledCache != null) { 549 if (_isGitInstalledCache != null) {
550 // TODO(rnystrom): The sleep is to pump the message queue. Can use 550 // TODO(rnystrom): The sleep is to pump the message queue. Can use
551 // Future.immediate() when #3356 is fixed. 551 // Future.immediate() when #3356 is fixed.
552 return sleep(0).transform((_) => _isGitInstalledCache); 552 return sleep(0).transform((_) => _isGitInstalledCache);
553 } 553 }
554 554
555 return _gitCommand.transform((git) => git != null); 555 return _gitCommand.transform((git) => git != null);
556 } 556 }
557 557
558 /// Run a git process with [args] from [workingDir]. 558 /// Run a git process with [args] from [workingDir].
559 Future<PubProcessResult> runGit(List<String> args, [String workingDir]) => 559 Future<PubProcessResult> runGit(List<String> args, {String workingDir}) =>
560 _gitCommand.chain((git) => runProcess(git, args, workingDir)); 560 _gitCommand.chain((git) => runProcess(git, args, workingDir: workingDir));
561 561
562 /// Returns the name of the git command-line app, or null if Git could not be 562 /// Returns the name of the git command-line app, or null if Git could not be
563 /// found on the user's PATH. 563 /// found on the user's PATH.
564 Future<String> get _gitCommand { 564 Future<String> get _gitCommand {
565 // TODO(nweiz): Just use Future.immediate once issue 3356 is fixed. 565 // TODO(nweiz): Just use Future.immediate once issue 3356 is fixed.
566 if (_gitCommandCache != null) { 566 if (_gitCommandCache != null) {
567 return sleep(0).transform((_) => _gitCommandCache); 567 return sleep(0).transform((_) => _gitCommandCache);
568 } 568 }
569 569
570 return _tryGitCommand("git").chain((success) { 570 return _tryGitCommand("git").chain((success) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 return new Directory(entry); 755 return new Directory(entry);
756 } 756 }
757 757
758 /** 758 /**
759 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. 759 * Gets a [Uri] for [uri], which can either already be one, or be a [String].
760 */ 760 */
761 Uri _getUri(uri) { 761 Uri _getUri(uri) {
762 if (uri is Uri) return uri; 762 if (uri is Uri) return uri;
763 return new Uri.fromString(uri); 763 return new Uri.fromString(uri);
764 } 764 }
OLDNEW
« no previous file with comments | « utils/pub/hosted_source.dart ('k') | utils/pub/source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698