Skip to content

feat(ssh): forward Ctrl+C (SIGINT) to remote command #411

@risu729

Description

@risu729

Problem

biwa does not install a handler for local SIGINT (Ctrl+C). The OS default terminates the client immediately, so the SSH session drops without telling the remote process to stop. Users expect Ctrl+C to interrupt the remote command (similar to OpenSSH), not only kill the local CLI.

Current behavior

  • Ctrl+C delivers SIGINT to biwa; the process exits with the usual shell convention (often exit code 130).
  • The SSH connection is torn down abruptly; there is no application-level forwarding of the interrupt to the remote session.

Desired behavior

  • While a remote command is running (especially with an interactive PTY / stdin forwarding), Ctrl+C should interrupt the remote process (or send the equivalent on the channel), not only exit the local client.
  • Graceful shutdown of the local client can remain a separate concern (e.g. second Ctrl+C, or explicit disconnect), but the primary interrupt should reach the remote.

Notes / implementation sketch

  • Likely requires handling tokio::signal::ctrl_c() (or equivalent) and mapping it to SSH semantics: e.g. send an interrupt character on the PTY stream and/or a channel signal request, depending on session type and what russh supports.
  • Must cover both PTY and non-PTY execution paths in src/ssh/exec.rs (and related client code) where behavior may differ.

Related

Remote exit status mapping for SIGINT on the server side already exists in src/ssh/client/execute.rs (ExitSignal → synthetic 130); this issue is about local Ctrl+C reaching the remote, not interpreting remote exit signals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions