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 (
81
81
github.com/containerd/plugin v1.0.0 // indirect
82
82
github.com/containerd/ttrpc v1.2.7 // indirect
83
83
github.com/containers/ocicrypt v1.2.1 // indirect
84
+ github.com/creack/pty v1.1.24 // indirect
84
85
github.com/djherbis/times v1.6.0 // indirect
85
86
github.com/docker/docker-credential-helpers v0.8.2 // indirect
86
87
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
76
76
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs =
77
77
github.com/coreos/go-systemd/v22 v22.5.0 /go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc =
78
78
github.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 =
81
81
github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s =
82
82
github.com/cyphar/filepath-securejoin v0.4.1 /go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI =
83
83
github.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
3
3
go 1.23
4
4
5
5
require (
6
+ github.com/creack/pty v1.1.24
6
7
golang.org/x/sync v0.11.0
7
8
golang.org/x/term v0.29.0
8
9
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 =
1
3
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI =
2
4
github.com/google/go-cmp v0.6.0 /go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY =
3
5
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w =
Original file line number Diff line number Diff line change 14
14
limitations under the License.
15
15
*/
16
16
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.
17
21
package pty
18
22
19
- import "errors"
23
+ import (
24
+ "errors"
25
+ "os"
26
+
27
+ creack "github.com/creack/pty"
28
+ )
20
29
21
30
var (
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" )
24
33
)
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