Skip to content

Commit e4d6352

Browse files
authored
Merge pull request #82 from hellojukay/master
fix windows handle error
2 parents 167a3d4 + ffdc2cf commit e4d6352

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

client.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,10 @@ func (c *defaultClient) Login() {
198198
}
199199
defer terminal.Restore(fd, state)
200200

201-
w, h, err := terminal.GetSize(fd)
201+
//changed fd to int(os.Stdout.Fd()) becaused terminal.GetSize(fd) doesn't work in Windows
202+
//refrence: https://github.com/golang/go/issues/20388
203+
w, h, err := terminal.GetSize(int(os.Stdout.Fd()))
204+
202205
if err != nil {
203206
l.Error(err)
204207
return

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ require (
1212

1313
require (
1414
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
15-
golang.org/x/sys v0.28.0 // indirect
16-
golang.org/x/term v0.27.0 // indirect
15+
golang.org/x/sys v0.31.0 // indirect
16+
golang.org/x/term v0.30.0 // indirect
1717
)

go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ss
1515
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
1616
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
1717
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
18+
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
19+
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
1820
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
1921
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
22+
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
23+
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
2024
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
2125
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2226
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=

0 commit comments

Comments
 (0)