Skip to content
PTY interface for Go
Go Shell
Latest commit 0467868 May 20, 2016 @creack creack Merge pull request #41 from mneumann/fix_dragonfly
Support DragonFly BSD
Failed to load latest commit information.
.gitignore initial May 3, 2011
License add MIT license; closes #2 Apr 5, 2012
README.md remove obsolete caveat Dec 3, 2012
doc.go define public symbols without build constraints Mar 4, 2014
ioctl.go Portable ioctl calls Mar 14, 2014
ioctl_bsd.go Portable ioctl calls Mar 14, 2014
mktypes.bash Support DragonFly BSD May 20, 2016
pty_darwin.go add generated ztypes_arm.go and ztypes_freebsd_arm.go Mar 16, 2014
pty_dragonfly.go Support DragonFly BSD May 20, 2016
pty_freebsd.go add generated ztypes_arm.go and ztypes_freebsd_arm.go Mar 16, 2014
pty_linux.go Remove uintptr(...) Dec 4, 2014
pty_unsupported.go Support DragonFly BSD May 20, 2016
run.go run: don't override supplied SysProcAttr Oct 7, 2015
types.go Portable ioctl calls Mar 14, 2014
types_dragonfly.go Support DragonFly BSD May 20, 2016
types_freebsd.go add generated ztypes_arm.go and ztypes_freebsd_arm.go Mar 16, 2014
util.go get rows and cols in a tty Mar 16, 2013
ztypes_386.go Portable ioctl calls Mar 14, 2014
ztypes_amd64.go Portable ioctl calls Mar 14, 2014
ztypes_arm.go add generated ztypes_arm.go and ztypes_freebsd_arm.go Mar 16, 2014
ztypes_arm64.go Prevent arm64 file to be compiled anywhere else. Fixed #32. May 11, 2015
ztypes_dragonfly_amd64.go Support DragonFly BSD May 20, 2016
ztypes_freebsd_386.go add generated ztypes_arm.go and ztypes_freebsd_arm.go Mar 16, 2014
ztypes_freebsd_amd64.go add generated ztypes_arm.go and ztypes_freebsd_arm.go Mar 16, 2014
ztypes_freebsd_arm.go add generated ztypes_arm.go and ztypes_freebsd_arm.go Mar 16, 2014
ztypes_ppc64.go Add support for Power (ppc64, ppc64le) and System z (s390x) Nov 21, 2014
ztypes_ppc64le.go Add support for Power (ppc64, ppc64le) and System z (s390x) Nov 21, 2014
ztypes_s390x.go Add support for Power (ppc64, ppc64le) and System z (s390x) Nov 21, 2014

README.md

pty

Pty is a Go package for using unix pseudo-terminals.

Install

go get github.com/kr/pty

Example

package main

import (
    "github.com/kr/pty"
    "io"
    "os"
    "os/exec"
)

func main() {
    c := exec.Command("grep", "--color=auto", "bar")
    f, err := pty.Start(c)
    if err != nil {
        panic(err)
    }

    go func() {
        f.Write([]byte("foo\n"))
        f.Write([]byte("bar\n"))
        f.Write([]byte("baz\n"))
        f.Write([]byte{4}) // EOT
    }()
    io.Copy(os.Stdout, f)
}
Something went wrong with that request. Please try again.