Skip to content

fix: make Windows tool output decoding explicit - #9

Merged
guantw merged 1 commit into
masterfrom
fix/windows-external-output-encoding
Sep 1, 2026
Merged

fix: make Windows tool output decoding explicit#9
guantw merged 1 commit into
masterfrom
fix/windows-external-output-encoding

Conversation

@guantw

@guantw guantw commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Changes

  • Parse localized Windows netstat output as raw bytes so Python UTF-8 mode cannot break HDC listener detection.
  • Decode every HDC command as UTF-8 with replacement, including server lifecycle, UDID lookup, target listing, bundle inspection, and installation.
  • Raise an explicit, argument-safe process output error when captured output is undecodable or unexpectedly None, and discard localized taskkill output that is not consumed.
  • Add regression coverage and document the fix in the changelog.

Validation

  • python -m ruff format --check .
  • python -m ruff check .
  • python -m pytest --cov — unavailable because the existing editable-install environment does not contain the declared pytest-cov development dependency.
  • python -m pytest -q — 297 passed, 2 skipped.
  • PYTHONUTF8=1 PYTHONIOENCODING=utf-8 python -m pytest -q — 297 passed, 2 skipped, with no subprocess reader warnings.
  • New and repaired logic has account- and device-independent regression tests.
  • User-visible behavior is documented in CHANGELOG.md.
  • No token, certificate, private key, UDID, HAP, log, or machine configuration is committed.
  • No dependencies were added.
  • Portable packaging checks are not applicable.

Manual testing

On an authorized connected device, Installer.get_udid() returned a valid 64-character value both with Python's default encoding mode and with PYTHONUTF8=1. The value was not logged. Signing, deployment, and installation were not performed.

Parse localized netstat output as bytes and decode all HDC output as UTF-8. Report invalid captured output explicitly and avoid decoding localized taskkill output.
@guantw
guantw merged commit eb60b7e into master Sep 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant