OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// Helper functionality to make working with IO easier. | 5 /// Helper functionality to make working with IO easier. |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 /// Spawns and runs the process located at [executable], passing in [args]. | 676 /// Spawns and runs the process located at [executable], passing in [args]. |
677 /// | 677 /// |
678 /// Returns a [Future] that will complete with the results of the process after | 678 /// Returns a [Future] that will complete with the results of the process after |
679 /// it has ended. | 679 /// it has ended. |
680 /// | 680 /// |
681 /// The spawned process will inherit its parent's environment variables. If | 681 /// The spawned process will inherit its parent's environment variables. If |
682 /// [environment] is provided, that will be used to augment (not replace) the | 682 /// [environment] is provided, that will be used to augment (not replace) the |
683 /// the inherited variables. | 683 /// the inherited variables. |
684 Future<PubProcessResult> runProcess(String executable, List<String> args, | 684 Future<PubProcessResult> runProcess(String executable, List<String> args, |
685 {workingDir, Map<String, String> environment, bool runInShell: false}) { | 685 {workingDir, Map<String, String> environment, bool runInShell: false}) { |
686 return _descriptorPool.withResource(() async { | 686 return _descriptorPool.withResource/*<Future<PubProcessResult>>*/(() async { |
687 var result = await _doProcess(Process.run, executable, args, | 687 var result = await _doProcess(Process.run, executable, args, |
688 workingDir: workingDir, | 688 workingDir: workingDir, |
689 environment: environment, | 689 environment: environment, |
690 runInShell: runInShell); | 690 runInShell: runInShell); |
691 | 691 |
692 var pubResult = new PubProcessResult( | 692 var pubResult = new PubProcessResult( |
693 result.stdout, result.stderr, result.exitCode); | 693 result.stdout, result.stderr, result.exitCode); |
694 log.processResult(executable, pubResult); | 694 log.processResult(executable, pubResult); |
695 return pubResult; | 695 return pubResult; |
696 }); | 696 }); |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 | 1082 |
1083 // TODO(rnystrom): Remove this and change to returning one string. | 1083 // TODO(rnystrom): Remove this and change to returning one string. |
1084 static List<String> _toLines(String output) { | 1084 static List<String> _toLines(String output) { |
1085 var lines = splitLines(output); | 1085 var lines = splitLines(output); |
1086 if (!lines.isEmpty && lines.last == "") lines.removeLast(); | 1086 if (!lines.isEmpty && lines.last == "") lines.removeLast(); |
1087 return lines; | 1087 return lines; |
1088 } | 1088 } |
1089 | 1089 |
1090 bool get success => exitCode == exit_codes.SUCCESS; | 1090 bool get success => exitCode == exit_codes.SUCCESS; |
1091 } | 1091 } |
OLD | NEW |