I have done the following
Steps to reproduce
- Start
container stats (streaming mode)
- Ctrl-C to exit
Current behavior
After container stats exits, the terminal is still in "alternate" terminal screen state. (I've confirmed this using Ghostty Terminal Inspector feature.) The visible result of this in my terminal emulator is that the mouse scroll feature no longer works to navigate terminal scrollback.
In macOS Terminal.app, the mouse scroll feature does not seem affected, but you can verify that you are still in "alternate" screen by inspecting the "View" menu: “Show alternate screen” will be grayed out.
Expected behavior
Upon exiting, even as a result of Ctrl-C, container stats should restore terminal properties to their original values, i.e. switch to the "primary" screen, restore cursor visibility, and restore mouse features.
My suspicion is that the container process exits before the defer block had a chance to run:
|
// Streaming mode - continuously update like top |
|
// Enter alternate screen buffer and hide cursor |
|
print("\u{001B}[?1049h\u{001B}[?25l", terminator: "") |
|
fflush(stdout) |
|
|
|
defer { |
|
// Exit alternate screen buffer and show cursor again |
|
print("\u{001B}[?25h\u{001B}[?1049l", terminator: "") |
|
fflush(stdout) |
|
} |
|
|
|
try await runStreaming() |
Environment
- OS: 26.2
- Xcode: 26.4
- Container: 0.10.0
Relevant log output
Code of Conduct
I have done the following
Steps to reproduce
container stats(streaming mode)Current behavior
After
container statsexits, the terminal is still in "alternate" terminal screen state. (I've confirmed this using Ghostty Terminal Inspector feature.) The visible result of this in my terminal emulator is that the mouse scroll feature no longer works to navigate terminal scrollback.In macOS Terminal.app, the mouse scroll feature does not seem affected, but you can verify that you are still in "alternate" screen by inspecting the "View" menu: “Show alternate screen” will be grayed out.
Expected behavior
Upon exiting, even as a result of Ctrl-C,
container statsshould restore terminal properties to their original values, i.e. switch to the "primary" screen, restore cursor visibility, and restore mouse features.My suspicion is that the
containerprocess exits before thedeferblock had a chance to run:container/Sources/ContainerCommands/Container/ContainerStats.swift
Lines 49 to 60 in 31c866a
Environment
Relevant log output
Code of Conduct