I am working on a simple ssh client that connects to multiple remote hosts and allows the reading of log files. I manage to connect to and run commands on my remote machine
stdin, err := session.StdinPipe()
if err != nil {
log.Fatalf("Failed to establish stdin pipe: %v", err)
}
session.Stdout = os.Stdout
session.Stderr = os.Stderr
err = session.Shell()
if err != nil {
log.Fatal(err)
}
reader := bufio.NewReader(os.Stdin)
for {
text, _ := reader.ReadString('\n')
if text == "exit\n" {
break
}
if text == "br\n" {
// ??? HOW ???
continue
}
_, err = fmt.Fprintf(stdin, "%s", text)
if err != nil {
log.Fatal(err)
}
}
When I run tail -f access.tskv
I get the output on my stdin. My problem is that I cannot figure out how to send an interrupt signal to the shell on the remote machine.
Any ideas?