1

I needed to get the dimensions of my terminal window and I found this question which provided a working solution for me.
However, now I am writing a test for it, and both two of the top offered solutions (with cmd.Stdin = os.Stdin and Syscall) are returning an error for me:

stty: 'standard input': Inappropriate ioctl for device

I am using Goland IDE, but tests seem to fail running from IDE and command prompt altogether. Maybe any of you guys have an idea for how to solve or get to the root of this issue?

Backflash
  • 11
  • 2
  • stty needs a terminal or a psuedo terminal to work. If the test is launching the program it'll need to provide a terminal for it. Take a look at [pty](https://docs.python.org/3.2/library/pty.html), essentially you let the pty be the stdin/stdout/stderr of the program under test and it'll believe it's running on a terminal. – estabroo Apr 12 '19 at 16:58

0 Answers0