OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |