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

Side by Side Diff: tools/testing/dart/android.dart

Issue 2687963003: [dart:io] flush() stdin before close()ing (Closed)
Patch Set: Created 3 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
« no previous file with comments | « tests/standalone/io/stdin_sync_test.dart ('k') | no next file » | 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) 2013, 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 library android; 5 library android;
6 6
7 import "dart:async"; 7 import "dart:async";
8 import "dart:convert" show LineSplitter, UTF8; 8 import "dart:convert" show LineSplitter, UTF8;
9 import "dart:core"; 9 import "dart:core";
10 import "dart:collection"; 10 import "dart:collection";
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 Future<String> getOutput(Stream<List<int>> stream) { 48 Future<String> getOutput(Stream<List<int>> stream) {
49 return stream 49 return stream
50 .transform(UTF8.decoder) 50 .transform(UTF8.decoder)
51 .toList() 51 .toList()
52 .then((data) => data.join("")); 52 .then((data) => data.join(""));
53 } 53 }
54 54
55 return Process.start(executable, args).then((Process process) async { 55 return Process.start(executable, args).then((Process process) async {
56 if (stdin != null && stdin != '') { 56 if (stdin != null && stdin != '') {
57 process.stdin.write(stdin); 57 process.stdin.write(stdin);
58 await process.stdin.flush();
58 } 59 }
59 process.stdin.close(); 60 process.stdin.close();
60 61
61 Timer timer; 62 Timer timer;
62 bool timedOut = false; 63 bool timedOut = false;
63 if (timeout != null) { 64 if (timeout != null) {
64 timer = new Timer(timeout, () { 65 timer = new Timer(timeout, () {
65 timedOut = true; 66 timedOut = true;
66 process.kill(ProcessSignal.SIGTERM); 67 process.kill(ProcessSignal.SIGTERM);
67 timer = null; 68 timer = null;
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 431
431 void releaseDevice(AdbDevice device) { 432 void releaseDevice(AdbDevice device) {
432 if (_waiter.length > 0) { 433 if (_waiter.length > 0) {
433 Completer completer = _waiter.removeFirst(); 434 Completer completer = _waiter.removeFirst();
434 completer.complete(device); 435 completer.complete(device);
435 } else { 436 } else {
436 _idleDevices.add(device); 437 _idleDevices.add(device);
437 } 438 }
438 } 439 }
439 } 440 }
OLDNEW
« no previous file with comments | « tests/standalone/io/stdin_sync_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698