We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba193d1 commit e1e5d11Copy full SHA for e1e5d11
invoke/terminals.py
@@ -10,6 +10,7 @@
10
from contextlib import contextmanager
11
from typing import Generator, IO, Optional, Tuple
12
import os
13
+import struct
14
import select
15
import sys
16
@@ -243,6 +244,7 @@ def bytes_to_read(input_: IO) -> int:
243
244
# it's not a tty but has a fileno, or vice versa; neither is typically
245
# going to work re: ioctl().
246
if not WINDOWS and isatty(input_) and has_fileno(input_):
- fionread = fcntl.ioctl(input_, termios.FIONREAD, b" ")
247
- return int(struct.unpack("h", fionread)[0])
+ arg = bytes(bytearray(struct.calcsize("i")))
248
+ fionread = fcntl.ioctl(input_, termios.FIONREAD, arg)
249
+ return int(struct.unpack("i", fionread)[0])
250
return 1
0 commit comments