mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-03-10 04:59:55 +01:00
Check for fileno attribute in _tty_width function
When using Options parser within a unittest.TextTestRunner with buffering enabled (buffer=True), it fails with: AttributeError: StringIO instance has no attribute 'fileno' This change will prevent this kind of error.
This commit is contained in:
parent
00f20657e3
commit
bbd54e150d
@ -61,6 +61,8 @@ def _remove_negative_k(k):
|
||||
|
||||
|
||||
def _tty_width():
|
||||
if not hasattr(sys.stderr, "fileno"):
|
||||
return _atoi(os.environ.get('WIDTH')) or 70
|
||||
s = struct.pack("HHHH", 0, 0, 0, 0)
|
||||
try:
|
||||
import fcntl
|
||||
|
Loading…
Reference in New Issue
Block a user