Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetWinsize: inappropriate ioctl for device #6

Open
dncohen opened this issue Aug 13, 2016 · 7 comments
Open

GetWinsize: inappropriate ioctl for device #6

dncohen opened this issue Aug 13, 2016 · 7 comments

Comments

@dncohen
Copy link

dncohen commented Aug 13, 2016

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.

@buger
Copy link
Owner

buger commented Aug 13, 2016

Hello! Can you clarify if it is 32 or 64 bit os?

On Sat, Aug 13, 2016 at 10:35 AM, dncohen notifications@github.com 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
#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

@dncohen
Copy link
Author

dncohen commented Aug 19, 2016

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

@bunkat
Copy link

bunkat commented Nov 12, 2016

64-bit Ubuntu 14.04 running into the same issue.

@c4s4
Copy link

c4s4 commented Jun 28, 2017

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.

@augustawind
Copy link

I have the same issue, but only when running my program to the right of a Unix pipe.

@holygeek
Copy link

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.

@mh-cbon
Copy link

mh-cbon commented Mar 11, 2019

updating the module worked for me go get -u github.com/buger/goterm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants