Index: utils/pub/io.dart |
diff --git a/utils/pub/io.dart b/utils/pub/io.dart |
index 0c30c885dbb85046ad2d7999ee172b869224e213..06f818d3264189a9ba8e52ce2f84a3f8b6ad23c0 100644 |
--- a/utils/pub/io.dart |
+++ b/utils/pub/io.dart |
@@ -619,7 +619,12 @@ Future pipeInputToInput(InputStream source, ListInputStream sink) { |
sink.markEndOfStream(); |
completer.complete(null); |
}; |
- source.onData = () => sink.write(source.read()); |
+ source.onData = () { |
+ // Even if the sink is closed and we aren't going to do anything with more |
+ // data, we still need to drain it from source to work around issue 7218. |
+ var data = source.read(); |
+ if (!sink.closed) sink.write(data); |
+ }; |
// TODO(nweiz): propagate this error to the sink. See issue 3657. |
source.onError = (e) { throw e; }; |
return completer.future; |