Index: test/io.dart |
diff --git a/test/io.dart b/test/io.dart |
index 9dccdaef5772d4ed5f3c1430ca33f7ea67b2d504..dcfe3b910817198f547991c618d8607149161f62 100644 |
--- a/test/io.dart |
+++ b/test/io.dart |
@@ -4,6 +4,7 @@ |
library test.test.io; |
+import 'dart:async'; |
import 'dart:io'; |
import 'package:path/path.dart' as p; |
@@ -12,6 +13,11 @@ import 'package:test/src/util/io.dart'; |
/// The path to the root directory of the `test` package. |
final String packageDir = p.dirname(p.dirname(libraryPath(#test.test.io))); |
+/// The path to the `pub` executable in the current Dart SDK. |
+final _pubPath = p.join( |
+ p.dirname(Platform.executable), |
+ Platform.isWindows ? 'pub.bat' : 'pub'); |
+ |
/// Runs the test executable with the package root set properly. |
ProcessResult runUnittest(List<String> args, {String workingDirectory, |
Map<String, String> environment}) { |
@@ -37,3 +43,19 @@ ProcessResult runDart(List<String> args, {String workingDirectory, |
return Process.runSync(Platform.executable, allArgs, |
workingDirectory: workingDirectory, environment: environment); |
} |
+ |
+/// Runs Pub. |
+ProcessResult runPub(List<String> args, {String workingDirectory, |
+ Map<String, String> environment}) { |
+ // TODO(nweiz): Use ScheduledProcess once it's compatible. |
+ return Process.runSync(_pubPath, args, |
+ workingDirectory: workingDirectory, environment: environment); |
+} |
+ |
+/// Starts Pub. |
+Future<Process> startPub(List<String> args, {String workingDirectory, |
+ Map<String, String> environment}) { |
+ // TODO(nweiz): Use ScheduledProcess once it's compatible. |
+ return Process.start(_pubPath, args, |
+ workingDirectory: workingDirectory, environment: environment); |
+} |