File tree Expand file tree Collapse file tree 9 files changed +31
-149
lines changed
Expand file tree Collapse file tree 9 files changed +31
-149
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ require (
8181 github.com/containerd/plugin v1.0.0 // indirect
8282 github.com/containerd/ttrpc v1.2.7 // indirect
8383 github.com/containers/ocicrypt v1.2.1 // indirect
84+ github.com/creack/pty v1.1.24 // indirect
8485 github.com/djherbis/times v1.6.0 // indirect
8586 github.com/docker/docker-credential-helpers v0.8.2 // indirect
8687 github.com/felixge/httpsnoop v1.0.4 // indirect
Original file line number Diff line number Diff line change @@ -76,8 +76,8 @@ github.com/coreos/go-iptables v0.8.0/go.mod h1:Qe8Bv2Xik5FyTXwgIbLAnv2sWSBmvWdFE
7676github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs =
7777github.com/coreos/go-systemd/v22 v22.5.0 /go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc =
7878github.com/cpuguy83/go-md2man/v2 v2.0.6 /go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g =
79- github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY =
80- github.com/creack/pty v1.1.18 /go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4 =
79+ github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s =
80+ github.com/creack/pty v1.1.24 /go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE =
8181github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s =
8282github.com/cyphar/filepath-securejoin v0.4.1 /go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI =
8383github.com/davecgh/go-spew v1.1.0 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ module github.com/containerd/nerdctl/mod/tigron
33go 1.23
44
55require (
6+ github.com/creack/pty v1.1.24
67 golang.org/x/sync v0.11.0
78 golang.org/x/term v0.29.0
89 gotest.tools/v3 v3.5.2
Original file line number Diff line number Diff line change 1+ github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s =
2+ github.com/creack/pty v1.1.24 /go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE =
13github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI =
24github.com/google/go-cmp v0.6.0 /go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY =
35golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w =
Original file line number Diff line number Diff line change 1414 limitations under the License.
1515*/
1616
17+ // Package pty.
18+ // Note that creack is MIT licensed, making it better to depend on it rather than using derived code here.
19+ // Underlying creack implementation is OK though they have more (unnecessary to us) features and do not follow the
20+ // same coding standards.
1721package pty
1822
19- import "errors"
23+ import (
24+ "errors"
25+ "os"
26+
27+ creack "github.com/creack/pty"
28+ )
2029
2130var (
22- ErrPTYFailure = errors .New ("pty failure" )
23- ErrPTYUnsupportedPlatform = errors .New ("pty not supported on this platform" )
31+ ErrFailure = errors .New ("pty failure" )
32+ ErrUnsupportedPlatform = errors .New ("pty not supported on this platform" )
2433)
34+
35+ func Open () (* os.File , * os.File , error ) {
36+ pty , tty , err := creack .Open ()
37+ if err != nil {
38+ if errors .Is (err , creack .ErrUnsupported ) {
39+ err = errors .Join (ErrUnsupportedPlatform , err )
40+ } else {
41+ err = errors .Join (ErrFailure , err )
42+ }
43+ }
44+
45+ return pty , tty , err
46+ }
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments