Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc949d44

Browse files
committed
Test out pipePty implementation
1 parent2d1405c commitc949d44

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-
funcnewPty() (Pty,error) {
15+
//funcpipePty() (Pty, error) {
1516
// We use the CreatePseudoConsole API which was introduced in build 17763
16-
vsn:=windows.RtlGetVersion()
17-
ifvsn.MajorVersion<10||
18-
vsn.BuildNumber<17763 {
19-
returnpipePty()
20-
}
17+
//vsn := windows.RtlGetVersion()
18+
//if vsn.MajorVersion < 10 ||
19+
//vsn.BuildNumber < 17763 {
20+
//return pipePty()
21+
//}
2122

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

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

46-
func (p*pipePtyVal)WriteString(string) (int,error) {
47-
returnp.w.WriteString(string)
47+
func (p*pipePtyVal)Reader() io.Reader {
48+
returnp.r
49+
}
50+
51+
func (p*pipePtyVal)WriteString(strstring) (int,error) {
52+
returnp.w.WriteString(str)
4853
}
4954

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp