Skip to content

fix(web): decode pip output as UTF-8 so update check/upgrade work on Windows - #313

Merged
hyoshi merged 1 commit into
mainfrom
fix/pip-subprocess-utf8-windows
Jun 22, 2026
Merged

fix(web): decode pip output as UTF-8 so update check/upgrade work on Windows#313
hyoshi merged 1 commit into
mainfrom
fix/pip-subprocess-utf8-windows

Conversation

@hyoshi

@hyoshi hyoshi commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Problem

The configure "About mureo" update check + one-click upgrade work on macOS/Linux but fail on Windows. The three capturing pip subprocess.run(text=True) calls omit encoding=, so text mode decodes pip's UTF-8 output with the locale codec — cp932 on a Japanese Windows — raising UnicodeDecodeError. In _run_pip_report that error isn't caught (only TimeoutExpired/OSError), so the update check silently dies; in run_upgrade_all it escapes the handler and breaks the upgrade.

Fix

Add encoding="utf-8", errors="replace" to the three capturing pip calls (version_check _run_pip_report, upgrade_action run_upgrade_all, cli _pip_is_available). UTF-8 is pip's actual output encoding on every platform (no macOS/Linux behaviour change); errors="replace" makes decoding never raise. Regression tests assert the encoding kwargs on all three calls.

python-reviewer: APPROVE (no CRITICAL/HIGH).

https://claude.ai/code/session_01NxBrN8Qn53Tpivt9SumdGn

…Windows

The configure "About mureo" update check and one-click upgrade worked on
macOS/Linux but failed on Windows. All three capturing pip subprocess calls
used `text=True` without `encoding=`, so text mode decoded pip's output with
the platform locale codec — cp932 on a Japanese Windows — while pip emits
UTF-8 (its `--report -` JSON, install logs). Non-cp932 bytes raised
UnicodeDecodeError; in `_run_pip_report` that error was not caught (only
TimeoutExpired/OSError were), so the background update check silently died,
and in `run_upgrade_all` it escaped the (TimeoutExpired, OSError) handler and
broke the upgrade.

Force `encoding="utf-8", errors="replace"` on the three capturing pip calls:
- web/version_check.py `_run_pip_report` (the About update check)
- web/upgrade_action.py `run_upgrade_all` (the one-click upgrade)
- cli/upgrade_cmd.py `_pip_is_available` (`mureo upgrade` CLI, same latent bug)

UTF-8 matches pip's actual output on every platform, so macOS/Linux behaviour
is unchanged; `errors="replace"` guarantees decoding never raises even on
genuinely malformed bytes (it then degrades to the existing graceful-failure
paths). The two streaming calls (`_run_pip_install`, `_bootstrap_pip`) capture
nothing and need no change. Regression tests assert the encoding kwargs on all
three calls. python-reviewer: APPROVE.

Claude-Session: https://claude.ai/code/session_01NxBrN8Qn53Tpivt9SumdGn
@hyoshi
hyoshi merged commit 95aab4f into main Jun 22, 2026
9 checks passed
@hyoshi
hyoshi deleted the fix/pip-subprocess-utf8-windows branch June 22, 2026 03:52
@hyoshi hyoshi mentioned this pull request Jun 22, 2026
hyoshi added a commit that referenced this pull request Jun 22, 2026
Release 0.10.10 — two Windows-surfaced field fixes: (#313) pip output decoded as UTF-8 so the About update check + one-click upgrade work under cp932; (#315) the read-only Reports view tolerates nonconforming campaign entries instead of blanking the dashboard. Version bumped across pyproject / __init__ / .claude-plugin; CHANGELOG updated.
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