| Index: utils/pub/io.dart
|
| diff --git a/utils/pub/io.dart b/utils/pub/io.dart
|
| index 60f6d77f75f299afb905f98554dbfcd218228245..1ab274c3626447853ccefe0cab4382c116263f69 100644
|
| --- a/utils/pub/io.dart
|
| +++ b/utils/pub/io.dart
|
| @@ -425,6 +425,21 @@ Future<bool> confirm(String message) {
|
| .then((line) => new RegExp(r"^[yY]").hasMatch(line));
|
| }
|
|
|
| +/// Reads and discards all output from [inputStream]. Returns a [Future] that
|
| +/// completes when the stream is closed.
|
| +Future drainInputStream(InputStream inputStream) {
|
| + var completer = new Completer();
|
| + if (inputStream.closed) {
|
| + completer.complete();
|
| + return completer.future;
|
| + }
|
| +
|
| + inputStream.onClosed = () => completer.complete();
|
| + inputStream.onData = inputStream.read;
|
| + inputStream.onError = (error) => completer.completeError(error);
|
| + return completer.future;
|
| +}
|
| +
|
| /// Wraps [stream] in a single-subscription [Stream] that emits the same data.
|
| ByteStream wrapInputStream(InputStream stream) {
|
| var controller = new StreamController();
|
|
|