Make RecordingInputStream output non-UTF8 responses or responses with non-ascii chars early in the string (probably binary) as hexdump.

This eases debugging of workers.

Also fixes a bug encountered while adding a test.

Example output:
---8<---8<--- Start of response ---8<---8<---
Not UTF-8, printing first 256 bytes as hex
49 27 6D 20 61 20 70 6F  69 73 6F 6E 65 64 20 77  |I'm a po isoned w|
6F 72 6B 65 72 20 61 6E  64 20 74 68 69 73 20 69  |orker an d this i|
73 20 6E 6F 74 20 61 20  70 72 6F 74 6F 62 75 66  |s not a  protobuf|
2E 0A 48 65 72 65 27 73  20 61 20 66 61 6B 65 20  |..Here's  a fake |
73 74 61 63 6B 20 74 72  61 63 65 20 66 6F 72 20  |stack tr ace for |
79 6F 75 3A 0A 20 20 20  20 61 74 20 63 6F 6D 2E  |you:.     at com.|
65 78 61 6D 70 6C 65 2E  53 6F 6D 65 74 68 69 6E  |example. Somethin|
67 28 53 6F 6D 65 74 68  69 6E 67 2E 6A 61 76 61  |g(Someth ing.java|
3A 38 33 29 0A 20 20 20  20 61 74 20 6A 61 76 61  |:83).     at java|
2E 6C 61 6E 67 2E 54 68  72 65 61 64 2E 72 75 6E  |.lang.Th read.run|
28 54 68 72 65 61 64 2E  6A 61 76 61 3A 37 34 35  |(Thread. java:745|
29 0A 41 6E 64 20 6E 6F  77 2C 20 38 6B 20 6F 66  |).And no w, 8k of|
20 72 61 6E 64 6F 6D 20  62 79 74 65 73 3A 20 61  | random  bytes: a|
37 19 C8 9B 63 59 5F E1  AB 90 63 0F 39 03 21 D8  |7...cY_. ..c.9.!.|
DF 74 EC 99 AE 76 AF 7B  8D 8F A6 99 7E EC E7 43  |.t...v.{ ....~..C|
83 24 5B B2 79 00 10 E2  37 E2 85 75 CD 10 10 B4  |.$[.y... 7..u....|
---8<---8<--- End of response ---8<---8<---

RELNOTES: None.
PiperOrigin-RevId: 378110216
3 files changed
tree: 7c09096fd837900dca916c440f3f64b46445da6a
  1. .bazelci/
  2. examples/
  3. scripts/
  4. site/
  5. src/
  6. third_party/
  7. tools/
  8. .bazelrc
  9. .gitattributes
  10. .gitignore
  11. AUTHORS
  12. BUILD
  13. CHANGELOG.md
  14. CODEBASE.md
  15. CODEOWNERS
  16. combine_distfiles.py
  17. combine_distfiles_to_tar.sh
  18. compile.sh
  19. CONTRIBUTING.md
  20. CONTRIBUTORS
  21. distdir.bzl
  22. distdir_deps.bzl
  23. ISSUE_TEMPLATE.md
  24. LICENSE
  25. README.md
  26. WORKSPACE
README.md

Bazel

{Fast, Correct} - Choose two

Build and test software of any size, quickly and reliably.

  • Speed up your builds and tests: Bazel rebuilds only what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.

  • One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.

  • Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.

  • Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.

Getting Started

Documentation

Contributing to Bazel

See CONTRIBUTING.md

Build status