CMS 3D CMS Logo

Classes | Functions | Variables
ztee Namespace Reference

Classes

class  GZipLog
 

Functions

def capture (fd, args)
 
def log (s)
 

Variables

 action
 
 args
 
 description
 
 fd
 
 help
 
 metavar
 
 parser
 
 str
 
 type
 

Function Documentation

◆ capture()

def ztee.capture (   fd,
  args 
)

Definition at line 94 of file ztee.py.

94 def capture(fd, args):
95  log_handler = GZipLog(log_file=args.log)
96 
97  def sigusr1_handle(*kargs, **kwargs):
98  log_handler._sigusr_interrupt = True
99  if log_handler.file:
100  log_handler.flush_block()
101 
102  signal.signal(signal.SIGUSR1, sigusr1_handle)
103 
104  try:
105  while True:
106  try:
107  log_handler._sigusr_interrupt = False
108  rlist, wlist, xlist = select.select([fd], [], [], 5)
109  except select.error as e:
110  if e[0] != errno.EINTR: raise
111  if not log_handler._sigusr_interrupt: raise
112 
113  continue
114 
115  if not rlist:
116  log_handler.handle_timeout()
117  continue
118 
119  bytes = os.read(fd, 4096)
120  if (bytes == ''):
121  break
122 
123  log_handler.write(bytes)
124  if not args.q:
125  sys.stdout.write(bytes)
126  finally:
127  log_handler.finish()
128 
def capture(fd, args)
Definition: ztee.py:94

◆ log()

def ztee.log (   s)

Definition at line 9 of file ztee.py.

9 def log(s):
10  sys.stderr.write("m: " + s + "\n");
11  sys.stderr.flush()
12 
def log(s)
Definition: ztee.py:9

Variable Documentation

◆ action

ztee.action

Definition at line 131 of file ztee.py.

◆ args

ztee.args

Definition at line 133 of file ztee.py.

◆ description

ztee.description

Definition at line 130 of file ztee.py.

◆ fd

ztee.fd

◆ help

ztee.help

Definition at line 131 of file ztee.py.

◆ metavar

ztee.metavar

Definition at line 132 of file ztee.py.

◆ parser

ztee.parser

Definition at line 130 of file ztee.py.

◆ str

ztee.str

Definition at line 132 of file ztee.py.

◆ type

ztee.type

Definition at line 132 of file ztee.py.