GetWinsize: inappropriate ioctl for device
Any idea why I get errors like these?
dave@tripper:goterm $ go run examples/chart_example.go
Error: GetWinsize: inappropriate ioctl for device
dave@tripper:goterm $ go run examples/table_example.go
Error: GetWinsize: inappropriate ioctl for device
dave@tripper:goterm $ go run examples/time_example.go
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Running on openbsd, if it matters. I've tried xterm, urxvt, tmux session - same error in each.
Thanks for any help.
Hello! Can you clarify if it is 32 or 64 bit os?
On Sat, Aug 13, 2016 at 10:35 AM, dncohen [email protected] wrote:
Any idea why I get errors like these?
dave@tripper:goterm $ go run examples/chart_example.go Error: GetWinsize: inappropriate ioctl for device dave@tripper:goterm $ go run examples/table_example.go Error: GetWinsize: inappropriate ioctl for device dave@tripper:goterm $ go run examples/time_example.go Error: GetWinsize: inappropriate ioctl for device Error: GetWinsize: inappropriate ioctl for device Error: GetWinsize: inappropriate ioctl for device Error: GetWinsize: inappropriate ioctl for device
Running on openbsd, if it matters. I've tried xterm, urxvt, tmux session - same error in each.
Thanks for any help.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/buger/goterm/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA2uYjzQMqL9TmHSgCJCRbZH9T19O7Nks5qfXPbgaJpZM4JjoOC .
Sincerely yours Leonid Bugaev http://gortool.com - test your system with real data
64-bit openbsd. Was running go 1.6.2.
Upgraded to go 1.7, same problems.
dave@tripper:goterm [master] $ go run examples/chart_example.go
Error: GetWinsize: inappropriate ioctl for device
dave@tripper:goterm [master] $ go version
go version go1.7 openbsd/amd64
64-bit Ubuntu 14.04 running into the same issue.
I have the same issue with code in attachement. test.zip
Unzip the archive, go in created directory and run 'go run test.go'. The library should look if parent is running in a terminal.
I have the same issue, but only when running my program to the right of a Unix pipe.
https://github.com/buger/goterm/blob/master/terminal_sysioctl.go#L26 uses os.Stdin as an argument to the ioctl system call. When the standard input is not a terminal then os.Stdin is useless to ioctl hence inappropriate ioctl for device error.
The fix is to check whether os.Stdin is a tty, and if not, try os.Stdout or os.Stderr (vim does something like this https://github.com/vim/vim/blob/master/src/os_unix.c#L3861).
It's not perfect though, as it can still fail if those three were not ttys.
updating the module worked for me go get -u github.com/buger/goterm