MCPcopy Create free account
hub / github.com/sqlmapproject/sqlmap / blockingReadFromFD

Function blockingReadFromFD

lib/core/subprocessng.py:30–51  ·  view source on GitHub ↗
(fd)

Source from the content-addressed store, hash-verified

28 import fcntl
29
30def blockingReadFromFD(fd):
31 # Quick twist around original Twisted function
32 # Blocking read from a non-blocking file descriptor
33 output = b""
34
35 while True:
36 try:
37 output += os.read(fd, 8192)
38 except (OSError, IOError) as ioe:
39 if ioe.args[0] in (errno.EAGAIN, errno.EINTR):
40 # Uncomment the following line if the process seems to
41 # take a huge amount of cpu time
42 # time.sleep(0.01)
43 continue
44 else:
45 raise
46 break
47
48 if not output:
49 raise EOFError("fd %s has been closed." % fd)
50
51 return output
52
53def blockingWriteToFD(fd, data):
54 # Another quick twist

Callers 1

_controlMsfCmdMethod · 0.90

Calls 1

readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…