Netflix-Skunkworks/go-expect

Name: go-expect

Owner: Netflix-Skunkworks

Description: an expect-like golang library to automate control of terminal or console based programs.

Created: 2018-05-14 17:53:19.0

Updated: 2018-05-15 21:52:56.0

Pushed: 2018-05-15 21:52:55.0

Homepage: null

Size: 18

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

go-expect

Build Status GoDoc NetflixOSS Lifecycle

Package expect provides an expect-like interface to automate control of terminal or console based programs. It is unlike expect and other go expect packages in that it does not spawn or control process lifecycle. This package only interfaces with a stdin and stdout and controls the interaction through those files alone.

Usage
rr := NewConsole()
rr != nil {
g.Fatal(err)

r c.Close()

:= exec.Command("prompt")
Stdin = c.Stdin()
Stdout = c.Stdout()
Stderr = c.Stdout()

unc() {
Expect("What is 1+1?")
SendLine("2")
Expect("What is Netflix backwards?")
SendLine("xilfteN")
ExpectEOF()


= cmd.Run()
rr != nil {
g.Fatal(err)


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.