Log stdout in adb.dart#187531
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates several ADB helper methods in adb.dart to include both stdout and stderr in error messages upon command failure, and updates the corresponding test expectations in adb_fake_io_test.dart. Feedback suggests decoding the binary stdout using utf8.decode in the screencap() method to ensure the error message remains human-readable instead of printing a raw byte list.
| throw StateError( | ||
| 'Failed to take screenshot: stderr: ${result.stderr}, stdout: ${result.stdout}', | ||
| ); |
There was a problem hiding this comment.
In screencap(), result is an AdbBinaryResult where result.stdout is a Uint8List (binary data). Interpolating a Uint8List directly into a string will print its default string representation (e.g., a list of byte integers like [101, 114, 114, 111, 114] or Instance of 'Uint8List'), which is not human-readable.
To log the actual text output, decode the Uint8List using utf8.decode (from dart:convert).
| throw StateError( | |
| 'Failed to take screenshot: stderr: ${result.stderr}, stdout: ${result.stdout}', | |
| ); | |
| throw StateError( | |
| 'Failed to take screenshot: stderr: ${result.stderr}, stdout: ${utf8.decode(result.stdout, allowMalformed: true)}', | |
| ); |
…b.dart Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
there are cases where the logs seem to show nothing. Presumably the error was actually on stdout?
Log the stdout as well in each case.
ex:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8681252155845819249/+/u/run_test.dart_for_android_engine_vulkan_tests_shard_and_subshard_None/stdout