4
4
package pty
5
5
6
6
import (
7
+ "io"
7
8
"os"
8
9
9
- "golang.org/x/sys/windows"
10
+ // "golang.org/x/sys/windows"
10
11
11
- "github.com/coder/coder/expect/conpty"
12
+ // "github.com/coder/coder/expect/conpty"
12
13
)
13
14
14
- func newPty () (Pty , error ) {
15
+ // func pipePty () (Pty, error) {
15
16
// We use the CreatePseudoConsole API which was introduced in build 17763
16
- vsn := windows .RtlGetVersion ()
17
- if vsn .MajorVersion < 10 ||
18
- vsn .BuildNumber < 17763 {
19
- return pipePty ()
20
- }
17
+ // vsn := windows.RtlGetVersion()
18
+ // if vsn.MajorVersion < 10 ||
19
+ // vsn.BuildNumber < 17763 {
20
+ // return pipePty()
21
+ // }
21
22
22
- return conpty .New (80 , 80 )
23
- }
23
+ // return conpty.New(80, 80)
24
+ // }
24
25
25
- func pipePty () (Pty , error ) {
26
+ func newPty () (Pty , error ) {
26
27
r , w , err := os .Pipe ()
27
28
if err != nil {
28
29
return nil , err
@@ -43,8 +44,12 @@ func (p *pipePtyVal) OutPipe() *os.File {
43
44
return p .r
44
45
}
45
46
46
- func (p * pipePtyVal ) WriteString (string ) (int , error ) {
47
- return p .w .WriteString (string )
47
+ func (p * pipePtyVal ) Reader () io.Reader {
48
+ return p .r
49
+ }
50
+
51
+ func (p * pipePtyVal ) WriteString (str string ) (int , error ) {
52
+ return p .w .WriteString (str )
48
53
}
49
54
50
55
func (p * pipePtyVal ) Resize (uint16 , uint16 ) error {
0 commit comments