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

Unified Diff: pkg/analysis_server/lib/src/channel.dart

Issue 235953019: Exit stdio-based analysis server when stdin closed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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
« no previous file with comments | « pkg/analysis_server/lib/http_server.dart ('k') | pkg/analysis_server/lib/stdio_server.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/channel.dart
diff --git a/pkg/analysis_server/lib/src/channel.dart b/pkg/analysis_server/lib/src/channel.dart
index 850585b257d710dd0b9aa80228ecd53b3152265d..f6b32300f8f93d0adbb10b4f0a98afa233e956da 100644
--- a/pkg/analysis_server/lib/src/channel.dart
+++ b/pkg/analysis_server/lib/src/channel.dart
@@ -178,14 +178,29 @@ class ByteStreamServerChannel implements ServerCommunicationChannel {
final Stream input;
final IOSink output;
+ /**
+ * Completer that will be signalled when the input stream is closed.
+ */
+ final Completer _closed = new Completer();
+
ByteStreamServerChannel(this.input, this.output);
+ /**
+ * Future that will be completed when the input stream is closed.
+ */
+ Future get closed {
+ return _closed.future;
+ }
+
@override
void listen(void onRequest(Request request), {Function onError, void
onDone()}) {
input.transform((new Utf8Codec()).decoder).transform(new LineSplitter()
).listen((String data) => _readRequest(data, onRequest), onError: onError,
- onDone: onDone);
+ onDone: () {
+ _closed.complete();
Brian Wilkerson 2014/04/16 17:23:43 Out of curiosity, why not just add this line to on
Paul Berry 2014/04/16 17:28:40 Because onDone() isn't a local function. It's pas
+ onDone();
+ });
}
@override
« no previous file with comments | « pkg/analysis_server/lib/http_server.dart ('k') | pkg/analysis_server/lib/stdio_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698