Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Spawn() fails with "inappropriate ioctl for device" error on Go 1.11 #23

Open
hachi8833 opened this issue Sep 11, 2018 · 3 comments
Open
Labels
enhancement feature request Add new features to Go Expect.

Comments

@hachi8833
Copy link

  • macOS: 10.13.6
  • Go: 1.11

Tests on master branch fails:

goexpect/master$ go test .
2018/09/11 23:43:37 at login prompt
2018/09/11 23:43:37 at password prompt
2018/09/11 23:43:39 Done sent
E0911 23:43:39.901595   19055 expect_test.go:136] Accept failed: accept tcp [::]:65226: use of closed network connection
E0911 23:43:39.910121   19055 expect_test.go:204] PTY cols/rows: 240/22 want: 120/40
E0911 23:43:39.910250   19055 expect_test.go:136] Accept failed: accept tcp [::]:65231: use of closed network connection
2018/09/11 23:43:39 Write failed: io: read/write on closed pipe
2018/09/11 23:43:39 Write failed: io: read/write on closed pipe
--- FAIL: TestSpawn (0.00s)
    expect_test.go:948: Nil return code: Spawn("/bin/true") = true want: false, err: inappropriate ioctl for device
    expect_test.go:948: Non nil return code: Spawn("/bin/false") = true want: false, err: inappropriate ioctl for device
    expect_test.go:948: Spawn cat: Spawn("/bin/cat") = true want: false, err: inappropriate ioctl for device
--- FAIL: TestSpawnWithArgs (0.00s)
    expect_test.go:971: Spawn(echo 'a   b') failed: inappropriate ioctl for device
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x11ee48c]

goroutine 46 [running]:
testing.tRunner.func1(0xc000110900)
	/usr/local/opt/go/libexec/src/testing/testing.go:792 +0x387
panic(0x123f720, 0x144d5a0)
	/usr/local/opt/go/libexec/src/runtime/panic.go:513 +0x1b9
github.com/google/goexpect.(*GExpect).ExpectSwitchCase(0x0, 0xc000251ec8, 0x1, 0x1, 0x17d78400, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/hachi8833/deve/golang/gopath/sys/src/github.com/google/goexpect/expect.go:620 +0x1cc
github.com/google/goexpect.(*GExpect).Expect(0x0, 0xc0004020a0, 0x17d78400, 0xc000251f58, 0x1, 0x1, 0x0, 0x0, 0x0, 0x12c4100)
	/Users/hachi8833/deve/golang/gopath/sys/src/github.com/google/goexpect/expect.go:1125 +0xd1
github.com/google/goexpect.TestSpawnWithArgs(0xc000110900)
	/Users/hachi8833/deve/golang/gopath/sys/src/github.com/google/goexpect/expect_test.go:975 +0x139
testing.tRunner(0xc000110900, 0x1295258)
	/usr/local/opt/go/libexec/src/testing/testing.go:827 +0xbf
created by testing.(*T).Run
	/usr/local/opt/go/libexec/src/testing/testing.go:878 +0x353
FAIL	github.com/google/goexpect	4.220s
@skalle
Copy link
Contributor

skalle commented Oct 1, 2018

Hey Hachi8833 ..

This is due to goexpect , or rather goterm , only support linux.

I am working on adding in support for more OSes with FreeBSD being first out. Don't know how close Mac OS is to those though and don't have access to any macs atm.

@skalle skalle added enhancement feature request Add new features to Go Expect. labels Oct 1, 2018
@ryandgoulding
Copy link
Contributor

I experience the same limitation with macOS 10.15.4 and Go 1.14.1. Commenting so I receive any follow-up communication :).

@felixgao
Copy link

felixgao commented Jun 9, 2022

following up as well. I Seem to have a different error. I am using macOS 12.3.1, Go 1.18.3 on darwin/arm64, M1 Silicon.

go test .
go: downloading golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
go: downloading google.golang.org/grpc v1.31.0
go: downloading github.com/google/goterm v0.0.0-20190703233501-fc88cf888a3f
go: downloading github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
go: downloading google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55
go: downloading github.com/golang/protobuf v1.3.3
2022/06/09 13:39:46 at login prompt
2022/06/09 13:39:46 at password prompt
2022/06/09 13:39:48 Done sent
E0609 13:39:48.262938    9695 expect_test.go:138] Accept failed: accept tcp [::]:53049: use of closed network connection
--- FAIL: TestTee (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10077dcd8]

goroutine 178 [running]:
testing.tRunner.func1.2({0x100854ac0, 0x100a70080})
	/opt/homebrew/Cellar/go/1.18.3/libexec/src/testing/testing.go:1389 +0x1c8
testing.tRunner.func1()
	/opt/homebrew/Cellar/go/1.18.3/libexec/src/testing/testing.go:1392 +0x384
panic({0x100854ac0, 0x100a70080})
	/opt/homebrew/Cellar/go/1.18.3/libexec/src/runtime/panic.go:838 +0x204
github.com/google/goexpect.(*GExpect).check(0x140003a0dc8?)
	/Users/ggao/intuit/productivity/goexpect/expect.go:690 +0x28
github.com/google/goexpect.(*GExpect).Send(0x0, {0x100791cd1, 0x7})
	/Users/ggao/intuit/productivity/goexpect/expect.go:1223 +0x2c
github.com/google/goexpect.TestTee(0x14000540000)
	/Users/ggao/intuit/productivity/goexpect/expect_test.go:710 +0x160
testing.tRunner(0x14000540000, 0x1008a7e10)
	/opt/homebrew/Cellar/go/1.18.3/libexec/src/testing/testing.go:1439 +0x110
created by testing.(*T).Run
	/opt/homebrew/Cellar/go/1.18.3/libexec/src/testing/testing.go:1486 +0x300
FAIL	github.com/google/goexpect	5.105s
FAIL

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement feature request Add new features to Go Expect.
Projects
None yet
Development

No branches or pull requests

4 participants