Skip to content

dotnet-trace collect-linux leaves terminal cursor hidden after tracing completes #5706

@hoyosjs

Description

@hoyosjs

Description

After dotnet-trace collect-linux finishes collecting a trace and exits, the terminal cursor remains hidden. The cursor is not restored to its visible state on exit, leaving the user with an invisible cursor in their terminal session.

Steps to Reproduce

  1. Open a terminal session.
  2. Run dotnet-trace collect-linux -p <pid> (or any valid collect-linux invocation).
  3. Wait for trace collection to complete, or stop it with Ctrl+C / Enter.
  4. Observe that the terminal cursor is no longer visible after the tool exits.
  5. The terminal is still functional (typing works), but the cursor is invisible.

Expected Behavior

After dotnet-trace collect-linux exits — whether through normal completion, user-initiated stop, or signal — the terminal cursor should be restored to its visible state. The tool should ensure terminal state cleanup happens on all exit paths.

Actual Behavior

The cursor remains hidden after the tool exits. Users must manually restore it by running tput cnorm or reset to get their cursor back.

Additional Context

  • The tool likely hides the cursor (e.g., via ANSI escape \e[?25l) during collection for TUI/progress rendering but does not emit the corresponding show-cursor sequence (\e[?25h) on exit.
  • The fix should ensure cursor restoration on all exit paths: normal exit, SIGINT, SIGTERM, and any error/panic paths.
  • Consider using a cleanup guard or defer/finally pattern to guarantee terminal state is restored regardless of how the tool exits.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions