Skip to content

Child process exiting the alternate screen during shutdown takes down the terminal window on Windows #9077

Closed

Description

@kraso

Child process exiting the alternate screen during shutdown takes down the terminal window on Windows

Symptom

When a child process running in Alacritty on Windows leaves the alternate screen as part of its shutdown, the Alacritty window itself exits. Nothing is left to type at. Reproduced with an OpenTUI-based TUI, but I do not believe this is specific to that library: it looks like host behaviour on the exit sequence.

Reproduction

Same machine, same application build, two Windows terminals:

Host Result
Alacritty 0.17.0 (94e7c88), alone window exits with the process
Alacritty 0.17.0 (94e7c88) + zellij pane or window exits with the process
Windows Terminal (PowerShell 7.6.6) survives, 3 of 3 runs

The control case matters: Windows Terminal is also ConPTY and is unaffected by the same build, which is why I read this as Alacritty-specific rather than a ConPTY-wide problem.

Both an orderly exit command and an interrupt trigger it, and no multiplexer is required.

Control

The application can be configured not to use the alternate screen, and the failure disappears:

OTUI_USE_ALTERNATE_SCREEN=0

3 of 3 runs survive in Alacritty with the epilogue visible. That confirms the exit sequence from the alternate screen is the trigger, without saying why the host reacts by closing.

What I have not established

I have the trigger, not the mechanism. I do not know whether it is the ?1049l sequence itself, its ordering relative to process exit, or how Alacritty's ConPTY handling deals with a mode change arriving during teardown. I did not capture the raw byte stream, because the failure needs the host to actually close and a capture harness under my control does not close.

Versions

  • Alacritty 0.17.0 (94e7c88)
  • Windows 11
  • Application: @opencode/cli 2.0.28, and current dev (OpenTUI 0.5.17)

Links

Activity

  1. kraso commented on Oct 15, 2026

    @kraso
    Author

    Confirmed against the current release, not just a dev build.

    @opencode/cli 2.0.30 (latest at the time of writing) reproduces it, and OTUI_USE_ALTERNATE_SCREEN=0 works on that release as well. Verified from the packaged binary rather than from source:

    Build OTUI_USE_ALTERNATE_SCREEN unset OTUI_USE_ALTERNATE_SCREEN=0
    2.0.30 host terminal exits survives, epilogue visible, 3 of 3
    2.0.28 host terminal exits not measured

    So the behaviour is reproducible in a shipped artifact, and the application-side control works as documented in OpenTUI's env-vars.mdx.

    I have not determined whether Alacritty ever reaches the point of reacting to the sequence. What I can say is that the same bytes, from the same build, leave the host alive in Windows Terminal and dead in Alacritty 0.17.0. A capture of the raw stream during teardown would settle it, and I still do not have one, because the harness would have to be a real Alacritty window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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