From fba5c8196c7ebdf317ff980078fb8c0312132c6a Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Thu, 29 Oct 2020 22:40:42 -0600 Subject: [PATCH] Migrate from "github.com/kr/pty" to "github.com/creack/pty" Fixes "Setctty set but Ctty not valid in child with Go" error with Go 1.15 and up. See https://github.com/creack/pty/issues/96 --- README.md | 2 +- gexpect.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c30e0e2..09f7661 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,6 @@ See `gexpect_test.go` and the `examples` folder for full syntax ## Credits + github.com/creack/pty github.com/kballard/go-shellquote - github.com/kr/pty KMP Algorithm: "http://blog.databigbang.com/searching-for-substrings-in-streams-a-slight-modification-of-the-knuth-morris-pratt-algorithm-in-haxe/" diff --git a/gexpect.go b/gexpect.go index 6e918cb..852e6fc 100644 --- a/gexpect.go +++ b/gexpect.go @@ -13,8 +13,8 @@ import ( "time" "unicode/utf8" + "github.com/creack/pty" shell "github.com/kballard/go-shellquote" - "github.com/kr/pty" ) var ( @@ -387,7 +387,7 @@ func (expect *ExpectSubprocess) ReadUntil(delim byte) ([]byte, error) { for i := 0; i < n; i++ { if chunk[i] == delim { if len(chunk) > i+1 { - expect.buf.PutBack(chunk[i+1:n]) + expect.buf.PutBack(chunk[i+1 : n]) } return join, nil } else {