`nuxt dev`: takeover prompt loses raw mode when terminal doesn't answer OSC 11
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
- Domain
- cli, developer-experience
Research direction
Start with withUserAttention and host.withTerminal, then compare their stdin handling with attachKeys and whenStdinReleased() in src/boot.ts and the takeover prompt path. Reproduce in a terminal that does not answer OSC 11 and confirm the prompt retains raw mode after the timeout. Done means arrow keys move the selection and Enter submits it in that scenario.
Written by the indexing model from the issue text.
Description
Version: @nuxt/cli 4.0.3, Nuxt 4.6.4, Node 24.16, macOS
Repro
- Start
nuxt devin a project and leave it running. - In a terminal that does not reply to OSC 11 (
ESC ] 11 ; ? BEL), runnuxt devagain in the same project. - The "A Nuxt dev server is already running here" select prompt appears. Press ↑/↓.
Expected: the selection moves.
Actual: ~250ms after the prompt renders, stdin drops out of raw mode. Arrow keys echo as ^[[A, and Enter arrives as \n (readline names it enter, not return), so the prompt can't be answered. Only Ctrl-C gets out.
Cause
bootDevUI (src/boot.ts) paints the panel and calls queryBackground before the dev command reaches takeOverServer. listen() in src/dev/tui/background.ts captures wasRaw = false, sets raw mode, then in finish() (on reply or on the 250ms timeout) runs if (!wasRaw) stdin.setRawMode(false). By then clack's select has taken raw mode, so the restore turns it off underneath the prompt. attachKeys already waits for whenStdinReleased(); the takeover prompt (via withUserAttention) does not.
Verified by sampling the pty's termios flags: ICANON and ECHO switch back on 0.27s after the prompt appears. With NUXT_TERM_THEME=dark (no query sent), raw mode holds.
Suggested fix
Have withUserAttention / host.withTerminal await whenStdinReleased() before running the prompt, the same way attachKeys does. Alternatively, finish() could skip the raw-mode restore if stdin's raw state changed while the query was pending.
Workaround
export NUXT_TERM_THEME=dark (or light).
- Dominant language
- TypeScript
- Stars
- 402
- Forks
- 125
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 37
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nuxt/cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
dev: false "reachable from the network" warning when `devServer.host` is a `*.localhost` subdomainMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
Maintainers usually reply within 1 day
Similar issues
-
bug priority: low role: BE stage: now
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
ahmadrosid/nakama#2594 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
milind-soni/OpenMausBot#6495 ·
Maintainers usually reply within 1 day
-
Navigating the session tree adds the branch's prompts to Up-arrow history againPossibly taken @acmerfight claimed this today. Openuntriaged
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
earendil-works/pi#12279 ·
Maintainers usually reply within 1 day
-
approved documentation
Difficulty 1/5 Under an hour Newbie friendliness 89/100
vitest-dev/vitest#12015 · 4 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100