mirror of https://github.com/docker/cli.git
vendor: github.com/creack/pty v1.1.11
full diff: https://github.com/creack/pty/compare/v1.1.9...v1.1.11 - v1.1.11: Add arm support for OpenBSD - v1.1.10: Fix CTTY to work with go1.15 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
26721411b7
commit
4b47aed2cc
|
@ -9,7 +9,7 @@ github.com/containerd/continuity efbc4488d8fe1bdc16bde3b2d299
|
||||||
github.com/containerd/cgroups 318312a373405e5e91134d8063d04d59768a1bff
|
github.com/containerd/cgroups 318312a373405e5e91134d8063d04d59768a1bff
|
||||||
github.com/coreos/etcd d57e8b8d97adfc4a6c224fe116714bf1a1f3beb9 # v3.3.12
|
github.com/coreos/etcd d57e8b8d97adfc4a6c224fe116714bf1a1f3beb9 # v3.3.12
|
||||||
github.com/cpuguy83/go-md2man/v2 f79a8a8ca69da163eee19ab442bedad7a35bba5a # v2.0.0
|
github.com/cpuguy83/go-md2man/v2 f79a8a8ca69da163eee19ab442bedad7a35bba5a # v2.0.0
|
||||||
github.com/creack/pty 3a6a957789163cacdfe0e291617a1c8e80612c11 # v1.1.9
|
github.com/creack/pty 2a38352e8b4d7ab6c336eef107e42a55e72e7fbc # v1.1.11
|
||||||
github.com/davecgh/go-spew 8991bc29aa16c548c550c7ff78260e27b9ab7c73 # v1.1.1
|
github.com/davecgh/go-spew 8991bc29aa16c548c550c7ff78260e27b9ab7c73 # v1.1.1
|
||||||
github.com/docker/compose-on-kubernetes 78e6a00beda64ac8ccb9fec787e601fe2ce0d5bb # v0.5.0-alpha1
|
github.com/docker/compose-on-kubernetes 78e6a00beda64ac8ccb9fec787e601fe2ce0d5bb # v0.5.0-alpha1
|
||||||
github.com/docker/distribution 0d3efadf0154c2b8a4e7b6621fff9809655cc580
|
github.com/docker/distribution 0d3efadf0154c2b8a4e7b6621fff9809655cc580
|
||||||
|
|
|
@ -11,6 +11,8 @@ import (
|
||||||
// Start assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout,
|
// Start assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout,
|
||||||
// and c.Stderr, calls c.Start, and returns the File of the tty's
|
// and c.Stderr, calls c.Start, and returns the File of the tty's
|
||||||
// corresponding pty.
|
// corresponding pty.
|
||||||
|
//
|
||||||
|
// Starts the process in a new session and sets the controlling terminal.
|
||||||
func Start(c *exec.Cmd) (pty *os.File, err error) {
|
func Start(c *exec.Cmd) (pty *os.File, err error) {
|
||||||
return StartWithSize(c, nil)
|
return StartWithSize(c, nil)
|
||||||
}
|
}
|
||||||
|
@ -19,16 +21,35 @@ func Start(c *exec.Cmd) (pty *os.File, err error) {
|
||||||
// and c.Stderr, calls c.Start, and returns the File of the tty's
|
// and c.Stderr, calls c.Start, and returns the File of the tty's
|
||||||
// corresponding pty.
|
// corresponding pty.
|
||||||
//
|
//
|
||||||
// This will resize the pty to the specified size before starting the command
|
// This will resize the pty to the specified size before starting the command.
|
||||||
|
// Starts the process in a new session and sets the controlling terminal.
|
||||||
func StartWithSize(c *exec.Cmd, sz *Winsize) (pty *os.File, err error) {
|
func StartWithSize(c *exec.Cmd, sz *Winsize) (pty *os.File, err error) {
|
||||||
|
if c.SysProcAttr == nil {
|
||||||
|
c.SysProcAttr = &syscall.SysProcAttr{}
|
||||||
|
}
|
||||||
|
c.SysProcAttr.Setsid = true
|
||||||
|
c.SysProcAttr.Setctty = true
|
||||||
|
return StartWithAttrs(c, sz, c.SysProcAttr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartWithAttrs assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout,
|
||||||
|
// and c.Stderr, calls c.Start, and returns the File of the tty's
|
||||||
|
// corresponding pty.
|
||||||
|
//
|
||||||
|
// This will resize the pty to the specified size before starting the command if a size is provided.
|
||||||
|
// The `attrs` parameter overrides the one set in c.SysProcAttr.
|
||||||
|
//
|
||||||
|
// This should generally not be needed. Used in some edge cases where it is needed to create a pty
|
||||||
|
// without a controlling terminal.
|
||||||
|
func StartWithAttrs(c *exec.Cmd, sz *Winsize, attrs *syscall.SysProcAttr) (pty *os.File, err error) {
|
||||||
pty, tty, err := Open()
|
pty, tty, err := Open()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer tty.Close()
|
defer tty.Close()
|
||||||
|
|
||||||
if sz != nil {
|
if sz != nil {
|
||||||
err = Setsize(pty, sz)
|
if err := Setsize(pty, sz); err != nil {
|
||||||
if err != nil {
|
|
||||||
pty.Close()
|
pty.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -42,15 +63,11 @@ func StartWithSize(c *exec.Cmd, sz *Winsize) (pty *os.File, err error) {
|
||||||
if c.Stdin == nil {
|
if c.Stdin == nil {
|
||||||
c.Stdin = tty
|
c.Stdin = tty
|
||||||
}
|
}
|
||||||
if c.SysProcAttr == nil {
|
|
||||||
c.SysProcAttr = &syscall.SysProcAttr{}
|
c.SysProcAttr = attrs
|
||||||
}
|
|
||||||
c.SysProcAttr.Setctty = true
|
if err := c.Start(); err != nil {
|
||||||
c.SysProcAttr.Setsid = true
|
_ = pty.Close()
|
||||||
c.SysProcAttr.Ctty = int(tty.Fd())
|
|
||||||
err = c.Start()
|
|
||||||
if err != nil {
|
|
||||||
pty.Close()
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return pty, err
|
return pty, err
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
|
// cgo -godefs types_freebsd.go
|
||||||
|
|
||||||
|
package pty
|
||||||
|
|
||||||
|
const (
|
||||||
|
_C_SPECNAMELEN = 0xff
|
||||||
|
)
|
||||||
|
|
||||||
|
type fiodgnameArg struct {
|
||||||
|
Len int32
|
||||||
|
Buf *byte
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// +build openbsd
|
||||||
// cgo -godefs types_openbsd.go
|
// +build 386 amd64 arm arm64
|
||||||
|
|
||||||
package pty
|
package pty
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
|
||||||
// cgo -godefs types_openbsd.go
|
|
||||||
|
|
||||||
package pty
|
|
||||||
|
|
||||||
type ptmget struct {
|
|
||||||
Cfd int32
|
|
||||||
Sfd int32
|
|
||||||
Cn [16]int8
|
|
||||||
Sn [16]int8
|
|
||||||
}
|
|
||||||
|
|
||||||
var ioctl_PTMGET = 0x40287401
|
|
Loading…
Reference in New Issue