fix(review): address Copilot follow-up on sanitizer and file decode errors

Consume multi-byte non-CSI ESC sequences during ANSI sanitization and handle UnicodeDecodeError for `hermes send --file` so review findings are resolved without regressions.
This commit is contained in:
Brooklyn Nicholson 2026-05-16 23:00:58 -05:00
parent 7e1788db5d
commit a65f723e68
4 changed files with 24 additions and 1 deletions

View file

@ -59,7 +59,7 @@ def _read_message_body(
return sys.stdin.read()
try:
return Path(file_path).read_text(encoding="utf-8")
except OSError as exc:
except (OSError, UnicodeDecodeError) as exc:
print(f"hermes send: cannot read {file_path}: {exc}", file=sys.stderr)
sys.exit(_USAGE_EXIT)