| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012, 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 import 'dart:io'; |
| 6 import 'dart:isolate'; |
| 7 |
| 8 main() { |
| 9 // Open a port to make the script hang. |
| 10 var port = new ReceivePort(); |
| 11 // Start sub-process when receiving data. |
| 12 stdin.onData = () { |
| 13 var data = stdin.read(); |
| 14 var options = new Options(); |
| 15 Process.start(options.executable, [options.script]).then((p) { |
| 16 p.stdout.onData = p.stdout.read; |
| 17 p.stderr.onData = p.stderr.read; |
| 18 stdout.close(); |
| 19 // When receiving data again, kill sub-process and exit. |
| 20 stdin.onData = () { |
| 21 var data = stdin.read(); |
| 22 Expect.listEquals([1], data); |
| 23 p.kill(); |
| 24 p.onExit = port.close; |
| 25 }; |
| 26 }); |
| 27 }; |
| 28 } |
| OLD | NEW |