mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 05:27:07 +08:00
vendor: github.com/creack/pty v1.1.21
full diff: https://github.com/creack/pty/compare/v1.1.18...v1.1.21 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
17
vendor/github.com/creack/pty/pty_openbsd.go
generated
vendored
17
vendor/github.com/creack/pty/pty_openbsd.go
generated
vendored
@ -9,6 +9,17 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func cInt8ToString(in []int8) string {
|
||||
var s []byte
|
||||
for _, v := range in {
|
||||
if v == 0 {
|
||||
break
|
||||
}
|
||||
s = append(s, byte(v))
|
||||
}
|
||||
return string(s)
|
||||
}
|
||||
|
||||
func open() (pty, tty *os.File, err error) {
|
||||
/*
|
||||
* from ptm(4):
|
||||
@ -25,12 +36,12 @@ func open() (pty, tty *os.File, err error) {
|
||||
defer p.Close()
|
||||
|
||||
var ptm ptmget
|
||||
if err := ioctl(p.Fd(), uintptr(ioctl_PTMGET), uintptr(unsafe.Pointer(&ptm))); err != nil {
|
||||
if err := ioctl(p, uintptr(ioctl_PTMGET), uintptr(unsafe.Pointer(&ptm))); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pty = os.NewFile(uintptr(ptm.Cfd), "/dev/ptm")
|
||||
tty = os.NewFile(uintptr(ptm.Sfd), "/dev/ptm")
|
||||
pty = os.NewFile(uintptr(ptm.Cfd), cInt8ToString(ptm.Cn[:]))
|
||||
tty = os.NewFile(uintptr(ptm.Sfd), cInt8ToString(ptm.Sn[:]))
|
||||
|
||||
return pty, tty, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user