Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c949d44

Browse files
committed
Test out pipePty implementation
1 parent 2d1405c commit c949d44

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

cli/login_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build !windows
2-
31
package cli_test
42

53
import (

expect/pty/pty_windows.go

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,26 @@
44
package pty
55

66
import (
7+
"io"
78
"os"
89

9-
"golang.org/x/sys/windows"
10+
//"golang.org/x/sys/windows"
1011

11-
"github.com/coder/coder/expect/conpty"
12+
//"github.com/coder/coder/expect/conpty"
1213
)
1314

14-
func newPty() (Pty, error) {
15+
// func pipePty() (Pty, error) {
1516
// 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+
// }
2122

22-
return conpty.New(80, 80)
23-
}
23+
// return conpty.New(80, 80)
24+
// }
2425

25-
func pipePty() (Pty, error) {
26+
func newPty() (Pty, error) {
2627
r, w, err := os.Pipe()
2728
if err != nil {
2829
return nil, err
@@ -43,8 +44,12 @@ func (p *pipePtyVal) OutPipe() *os.File {
4344
return p.r
4445
}
4546

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)
4853
}
4954

5055
func (p *pipePtyVal) Resize(uint16, uint16) error {

0 commit comments

Comments
 (0)