File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 5
5
6
6
from abc import ABC , abstractmethod
7
7
from typing import Iterator , Union
8
- import fcntl
9
8
import json
10
9
import logging
11
10
import socket
12
11
import ssl
13
- import struct
14
- import termios
15
12
import time
16
13
14
+
15
+ # Use fcntl to control socket buffering if available
16
+ try :
17
+ import fcntl
18
+ import struct
19
+ import termios
20
+ except ImportError :
21
+ fcntl = None
22
+
17
23
from requests .auth import HTTPBasicAuth
18
24
import pylogbeat
19
25
import requests
@@ -145,6 +151,9 @@ def _wait_for_socket_buffer_empty(self):
145
151
146
152
# ----------------------------------------------------------------------
147
153
def _is_sock_write_buff_empty (self ):
154
+ if fcntl is None :
155
+ return True
156
+
148
157
socket_fd = self ._sock .fileno ()
149
158
buffer_size = struct .pack ('I' , 0 )
150
159
ioctl_result = fcntl .ioctl (socket_fd , termios .TIOCOUTQ , buffer_size )
You can’t perform that action at this time.
0 commit comments