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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 int exitCode = result.exitCode; | 326 int exitCode = result.exitCode; |
327 var lines = result | 327 var lines = result |
328 .stdout.split('\n') | 328 .stdout.split('\n') |
329 .where((line) => line.trim().length > 0) | 329 .where((line) => line.trim().length > 0) |
330 .toList(); | 330 .toList(); |
331 if (lines.length > 0) { | 331 if (lines.length > 0) { |
332 int index = lines.last.indexOf(MARKER); | 332 int index = lines.last.indexOf(MARKER); |
333 if (index >= 0) { | 333 if (index >= 0) { |
334 exitCode = int.parse( | 334 exitCode = int.parse( |
335 lines.last.substring(index + MARKER.length).trim()); | 335 lines.last.substring(index + MARKER.length).trim()); |
| 336 exitCode = exitCode.toSigned(8); |
336 } else { | 337 } else { |
337 // In case of timeouts, for example, we won't get the exitcode marker. | 338 // In case of timeouts, for example, we won't get the exitcode marker. |
338 assert(result.exitCode != 0); | 339 assert(result.exitCode != 0); |
339 } | 340 } |
340 } | 341 } |
341 return new AdbCommandResult( | 342 return new AdbCommandResult( |
342 result.command, result.stdout, result.stderr, exitCode, | 343 result.command, result.stdout, result.stderr, exitCode, |
343 result.timedOut); | 344 result.timedOut); |
344 } | 345 } |
345 | 346 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 427 |
427 void releaseDevice(AdbDevice device) { | 428 void releaseDevice(AdbDevice device) { |
428 if (_waiter.length > 0) { | 429 if (_waiter.length > 0) { |
429 Completer completer = _waiter.removeFirst(); | 430 Completer completer = _waiter.removeFirst(); |
430 completer.complete(device); | 431 completer.complete(device); |
431 } else { | 432 } else { |
432 _idleDevices.add(device); | 433 _idleDevices.add(device); |
433 } | 434 } |
434 } | 435 } |
435 } | 436 } |
OLD | NEW |