Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
PTY interface for Go
Go Shell
Branch: master
Failed to load latest commit information.
.gitignore initial
License add MIT license; closes #2
README.md remove obsolete caveat
doc.go define public symbols without build constraints
ioctl.go Portable ioctl calls
ioctl_bsd.go Portable ioctl calls
mktypes.bash Portable ioctl calls
pty_darwin.go add generated ztypes_arm.go and ztypes_freebsd_arm.go
pty_freebsd.go add generated ztypes_arm.go and ztypes_freebsd_arm.go
pty_linux.go Remove uintptr(...)
pty_unsupported.go Portable ioctl calls
run.go set controlling tty for new process; closes #8
types.go Portable ioctl calls
types_freebsd.go add generated ztypes_arm.go and ztypes_freebsd_arm.go
util.go get rows and cols in a tty
ztypes_386.go Portable ioctl calls
ztypes_amd64.go Portable ioctl calls
ztypes_arm.go add generated ztypes_arm.go and ztypes_freebsd_arm.go
ztypes_arm64.go Prevent arm64 file to be compiled anywhere else. Fixed #32.
ztypes_freebsd_386.go add generated ztypes_arm.go and ztypes_freebsd_arm.go
ztypes_freebsd_amd64.go add generated ztypes_arm.go and ztypes_freebsd_arm.go
ztypes_freebsd_arm.go add generated ztypes_arm.go and ztypes_freebsd_arm.go
ztypes_ppc64.go Add support for Power (ppc64, ppc64le) and System z (s390x)
ztypes_ppc64le.go Add support for Power (ppc64, ppc64le) and System z (s390x)
ztypes_s390x.go Add support for Power (ppc64, ppc64le) and System z (s390x)

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.