Skip to content

bug: apm init asks "Continue and overwrite?" three times on Windows CP950 terminals #602

@edenfunf

Description

@edenfunf

Description

On Windows systems with a non-UTF-8 console encoding (CP950, CP936, CP932), running apm init in a project that already has an apm.yml shows the overwrite confirmation prompt three times before accepting the answer.

Steps to Reproduce

  1. Set up a Windows machine with a CJK locale (e.g. Traditional Chinese, CP950)
  2. Create an APM project: apm init my-project
  3. Run apm init my-project a second time
  4. Type n and press Enter

Actual Behaviour

[!] apm.yml already exists
Continue and overwrite? [y/n]: n
[!] apm.yml already exists
Continue and overwrite? [y/n]: n
Continue and overwrite? [y/n]: n
[i] Initialization cancelled.

Expected Behaviour

The prompt appears once and the command exits cleanly.

Root Cause

init.py uses Rich Confirm.ask() wrapped in a try/except that falls back to click.confirm(). On CP950 terminals, Rich fails to decode the input, retries internally, then raises an exception — at which point the except block calls click.confirm() again. The user is asked three times.

Environment

  • OS: Windows 11, console code page CP950
  • apm version: v0.8.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions