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/Netflix/go-expect
Creates a console, runs a command, and expects output.
package main
import (
"fmt"
"os/exec"
"github.com/Netflix/go-expect"
)
func main() {
c, err := expect.NewConsole(expect.WithStdout(os.Stdout))
if err != nil {
panic(err)
}
defer c.Close()
cmd := exec.Command("echo", "hello")
cmd.Stdin = c.Tty()
cmd.Stdout = c.Tty()
cmd.Stderr = c.Tty()
go func() {
c.ExpectString("hello")
fmt.Println("matched")
}()
cmd.Run()
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
0.0.0-20220104043353-73e0943537d2latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.