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

Side by Side Diff: tests/standalone/io/regress_7191_script.dart

Issue 12316036: Merge IO v2 branch to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r18818 Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/standalone/io/regress_7097_test.dart ('k') | tests/standalone/io/regress_7191_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:io'; 5 import 'dart:io';
6 import 'dart:isolate'; 6 import 'dart:isolate';
7 7
8 main() { 8 main() {
9 // Open a port to make the script hang. 9 // Open a port to make the script hang.
10 var port = new ReceivePort(); 10 var port = new ReceivePort();
11 // Start sub-process when receiving data. 11 // Start sub-process when receiving data.
12 stdin.onData = () { 12 var subscription;
13 var data = stdin.read(); 13 subscription = stdin.listen((data) {
14 var options = new Options(); 14 var options = new Options();
15 Process.start(options.executable, [options.script]).then((p) { 15 Process.start(options.executable, [options.script]).then((p) {
16 p.stdout.onData = p.stdout.read; 16 p.stdout.listen((_) { });
17 p.stderr.onData = p.stderr.read; 17 p.stderr.listen((_) { });
18 // When receiving data again, kill sub-process and exit. 18 // When receiving data again, kill sub-process and exit.
19 stdin.onData = () { 19 subscription.onData((data) {
20 var data = stdin.read();
21 Expect.listEquals([0], data); 20 Expect.listEquals([0], data);
22 p.kill(); 21 p.kill();
23 p.onExit = exit; 22 p.exitCode.then(exit);
24 }; 23 });
25 // Close stdout. If handles are incorrectly inherited this will 24 // Close stdout. If handles are incorrectly inherited this will
26 // not actually close stdout and the test will hang. 25 // not actually close stdout and the test will hang.
27 stdout.close(); 26 stdout.close();
28 }); 27 });
29 }; 28 });
30 } 29 }
OLDNEW
« no previous file with comments | « tests/standalone/io/regress_7097_test.dart ('k') | tests/standalone/io/regress_7191_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698