Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

How to send 'Ctrl-C' to the interactive shell spawned by SpawnWithArgs #63

@fangxlmr

Description

@fangxlmr

Say, I run cat /proc/kmsg as a root user on the interfactive SSH shell spawned by SpawnWithArgs, but it will hangs for ever (since you wouldn't cat anything from the magic file /proc/kmsg even as root), so no following commands sent to this SSH shell will not be executed by the SSH shell since it is haning on. I'd like invoke Ctrl-C in this SSH shell spawned by goexpect to stop cat progress clearing the shell, just like what we will do in an actual one.

I've tried

  1. sending ASCII code \003 (by calling exp.Write()) wouldn't work.
  2. SendSignal batcher seems send signals to the SSH progress itself, not she SHELL inside the SSH session.

Are there any ways to do this? What did I miss here?

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