contrib/debugcmdserver.py
changeset 43076 2372284d9457
parent 28353 cd03fbd5ab57
child 45830 c102b704edb5
equal deleted inserted replaced
43075:57875cf423c9 43076:2372284d9457
    21 if sys.argv[1] == '-':
    21 if sys.argv[1] == '-':
    22     log = sys.stderr
    22     log = sys.stderr
    23 else:
    23 else:
    24     log = open(sys.argv[1], 'a')
    24     log = open(sys.argv[1], 'a')
    25 
    25 
       
    26 
    26 def read(size):
    27 def read(size):
    27     data = sys.stdin.read(size)
    28     data = sys.stdin.read(size)
    28     if not data:
    29     if not data:
    29         raise EOFError
    30         raise EOFError
    30     sys.stdout.write(data)
    31     sys.stdout.write(data)
    31     sys.stdout.flush()
    32     sys.stdout.flush()
    32     return data
    33     return data
       
    34 
    33 
    35 
    34 try:
    36 try:
    35     while True:
    37     while True:
    36         header = read(outputfmtsize)
    38         header = read(outputfmtsize)
    37         channel, length = struct.unpack(outputfmt, header)
    39         channel, length = struct.unpack(outputfmt, header)