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

Unified Diff: tests/standalone/io/stdio_socket_finalizer_test.dart

Issue 2791423002: [dart:io] Don't close stdin with a socket finalizer (Closed)
Patch Set: Address comments Created 3 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 | « runtime/platform/globals.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/stdio_socket_finalizer_test.dart
diff --git a/tests/standalone/io/stdio_socket_finalizer_test.dart b/tests/standalone/io/stdio_socket_finalizer_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..9fee3d03ed25f4ca2c648f76c294ac884c3e43eb
--- /dev/null
+++ b/tests/standalone/io/stdio_socket_finalizer_test.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// This test checks that stdin is *not* closed when an Isolate leaks it.
+
+import 'dart:async';
+import 'dart:io';
+import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void ConnectorIsolate(SendPort sendPort) {
+ stdin;
+ sendPort.send(true);
+}
+
+main() async {
+ asyncStart();
+ ReceivePort receivePort = new ReceivePort();
+ Isolate isolate = await Isolate.spawn(ConnectorIsolate, receivePort.sendPort);
+ Completer<Null> completer = new Completer<Null>();
+ receivePort.listen((msg) {
+ Expect.isTrue(msg is bool);
+ Expect.isTrue(msg);
+ isolate.kill();
+ completer.complete(null);
+ });
+ await completer.future;
+ stdin.listen((_) {}).cancel();
+ receivePort.close();
+ asyncEnd();
+}
« no previous file with comments | « runtime/platform/globals.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698