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

Unified Diff: test/io.dart

Issue 1062523003: Add support for --pub-serve. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 9 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
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);
+}
« lib/src/util/io.dart ('K') | « pubspec.yaml ('k') | test/runner/pub_serve_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698