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

Unified Diff: utils/pub/io.dart

Issue 11468039: Make pipeInputToInput yet more resilient to stream closure. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/io.dart
diff --git a/utils/pub/io.dart b/utils/pub/io.dart
index 06f818d3264189a9ba8e52ce2f84a3f8b6ad23c0..3c703517bd2dbe40acbdbdd3757f58248ab5a6b7 100644
--- a/utils/pub/io.dart
+++ b/utils/pub/io.dart
@@ -623,7 +623,12 @@ Future pipeInputToInput(InputStream source, ListInputStream sink) {
// 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);
+
+ // Force the program to spin the event loop to work around issue 4222 and
+ // get sink.closed to be set correctly.
Bob Nystrom 2012/12/08 03:51:05 Add some kind of TODO to do something less nasty h
+ sleep(0).then((_) {
+ if (!sink.closed) sink.write(data);
+ });
};
// TODO(nweiz): propagate this error to the sink. See issue 3657.
source.onError = (e) { throw e; };
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698