Skip to content

GetWinsize: inappropriate ioctl for device #6

Description

@dncohen

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.

Activity

  1. buger commented on Aug 13, 2016

    @buger
    Owner

    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

  2. dncohen commented on Aug 19, 2016

    @dncohen
    Author

    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
    
  3. bunkat commented on Nov 12, 2016

    @bunkat

    64-bit Ubuntu 14.04 running into the same issue.

  4. c4s4 commented on Jun 28, 2017

    @c4s4

    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.

  5. augustawind commented on Jul 12, 2017

    @augustawind

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

  6. holygeek commented on Jul 22, 2017

    @holygeek

    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.

  7. mh-cbon commented on Mar 11, 2019

    @mh-cbon

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions