c-bata/go-prompt

"panic: inappropriate ioctl for device" when stdin is reused

Closed this issue · 1 comments

Bug reports

When a program reads input from stdin (i.e, piped in before initializing the prompt), go-prompt attempts to reuse this same pipe to read user input interactively, resulting in a panic:

panic: inappropriate ioctl for device

goroutine 1 [running]:
github.com/c-bata/go-prompt.(*PosixParser).GetWinSize(0xc420102b90, 0x871ee0)
	/home/bradley/go/src/github.com/c-bata/go-prompt/input_posix.go:113 +0xdd

Expected Behavior

go-prompt should always open a fresh stdin descriptor when initialized

Current Behavior and Steps to Reproduce

Read from stdin before starting the prompt

Context

  • Operating System: Linux
  • Terminal Emulator: Terminator
  • tag of go-prompt or commit revision: aa7dc8b

Thanks you. 👍