Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 // | |
| 5 // This test checks that stdin is *not* closed when an Isolate leaks it. | |
| 6 | |
| 7 import 'dart:async'; | |
| 8 import 'dart:io'; | |
| 9 import 'dart:isolate'; | |
| 10 | |
| 11 import "package:async_helper/async_helper.dart"; | |
| 12 import "package:expect/expect.dart"; | |
| 13 | |
| 14 void ConnectorIsolate(SendPort sendPort) { | |
| 15 stdin; | |
| 16 sendPort.send(true); | |
| 17 } | |
| 18 | |
| 19 main() async { | |
| 20 asyncStart(); | |
| 21 ReceivePort receivePort = new ReceivePort(); | |
| 22 ReceivePort errorPort = new ReceivePort(); | |
|
rmacnak
2017/04/04 20:34:46
Dead
zra
2017/04/04 20:50:39
Done.
| |
| 23 Isolate isolate = await Isolate.spawn(ConnectorIsolate, receivePort.sendPort); | |
| 24 Completer<Null> completer = new Completer<Null>(); | |
| 25 receivePort.listen((msg) { | |
| 26 Expect.isTrue(msg is bool); | |
| 27 Expect.isTrue(msg); | |
| 28 isolate.kill(); | |
| 29 completer.complete(null); | |
| 30 }); | |
| 31 await completer.future; | |
| 32 stdin.listen((_) {}).cancel(); | |
| 33 errorPort.close(); | |
| 34 receivePort.close(); | |
| 35 asyncEnd(); | |
| 36 } | |
| OLD | NEW |