Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
expect
✓ github.com/tailscale/goexpect
Spawn an SSH session and automate login
package main
import (
"context"
"fmt"
"github.com/tailscale/goexpect"
)
func main() {
e, _, err := expect.Spawn("ssh", 30*time.Second, "user@host")
if err != nil {
panic(err)
}
defer e.Close()
e.Expect("password:", 10*time.Second)
e.Send("mypassword\n")
result, _, _ := e.Expect("$", 10*time.Second)
fmt.Println(result)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
0.0.0-20210902213824-6e8c725cea41latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.