def poll_tail_pipes(pipes, lastlines_dirpath=None, waitsecs=5):
 lines = []
 bad_pipes = []
 (ready, _, _) = select.select(pipes.keys(), (), (), waitsecs)
 for fi in ready:
  path = pipes[fi]
  data = fi.read()
  if (len(data) == 0):
   bad_pipes.append(fi)
   continue
  if lastlines_dirpath:
   write_lastlines_file(lastlines_dirpath, path, data)
  for line in data.splitlines():
   lines.append(('[%s] DCTB %s\n' % (path, line)))
 return (lines, bad_pipes)

def poll_tail_pipes ( pipes , lastlines_dirpath = None , waitsecs = 5 ) : lines = [ ] bad_pipes = [ ] ( ready , _ , _ ) = select . select ( pipes . keys ( ) , ( ) , ( ) , waitsecs ) for fi in ready : path = pipes [ fi ] data = fi . read ( ) if ( len ( data ) == 0 ) : bad_pipes . append ( fi ) continue if lastlines_dirpath : write_lastlines_file ( lastlines_dirpath , path , data ) for line in data . splitlines ( ) : lines . append ( ( '[%s] DCTB %s\n' % ( path , line ) ) ) return ( lines , bad_pipes )
wait on tail pipes for new data for waitsecs .