Skip to content

Windows/no-PTY shells require Enter after Ctrl-] to detach #2307

Description

@rlmd-fonseca

Summary

On Unix Sliver clients, interactive shells for Windows targets run without a remote PTY. In that code path the local terminal remains in canonical mode, so Ctrl-] is echoed as ^] and buffered until Enter is pressed. The client still displays Escape: press Ctrl-], which suggests immediate detachment.

Reproduction

  1. Connect to a Windows session from a Linux/Kali Sliver client.
  2. Run shell.
  3. Press Ctrl-].
  4. Observe ^] at the PowerShell prompt and no detach.
  5. Press Enter; the shell then detaches.

A standalone raw-input test confirms the terminal emits byte 0x1d correctly.

Root cause

Windows targets force noPty = true. runInteractive calls term.MakeRaw(0) only when enablePTY is true. Therefore local stdin stays canonical for Windows/no-PTY shells, while runAttachedIO expects to receive byte 0x1d immediately.

Suggested fix

Decouple local escape-key handling from remote PTY support. For Unix no-PTY shells, configure Ctrl-] as a temporary canonical EOL character (VEOL), or otherwise arrange immediate local escape detection while preserving canonical echo/editing. Restore the original terminal state on detach and exit.

A minimal fallback would be to change the displayed instruction for no-PTY shells to press Ctrl-], then Enter.

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