MCPcopy Create free account
hub / github.com/mininet/mininet / read

Method read

mininet/node.py:244–257  ·  view source on GitHub ↗

Buffered read from node, potentially blocking. size: maximum number of characters to return

( self, size=1024 )

Source from the content-addressed store, hash-verified

242 # Subshell I/O, commands and control
243
244 def read( self, size=1024 ):
245 """Buffered read from node, potentially blocking.
246 size: maximum number of characters to return"""
247 count = len( self.readbuf )
248 if count < size:
249 data = os.read( self.stdout.fileno(), size - count )
250 self.readbuf += self.decoder.decode( data )
251 if size >= len( self.readbuf ):
252 result = self.readbuf
253 self.readbuf = ''
254 else:
255 result = self.readbuf[ :size ]
256 self.readbuf = self.readbuf[ size: ]
257 return result
258
259 def readline( self ):
260 """Buffered readline from node, potentially blocking.

Callers 15

startShellMethod · 0.95
readlineMethod · 0.95
monitorMethod · 0.95
customMethod · 0.80
beginMethod · 0.80
waitForNodeMethod · 0.80
runCpuLimitTestMethod · 0.80
oldQuietRunFunction · 0.80
errRunFunction · 0.80
pmonitorFunction · 0.80
setManualConfigMethod · 0.80
rcmdMethod · 0.80

Calls 1

decodeMethod · 0.80

Tested by

no test coverage detected