Revision 1686
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/streams.py | ||
---|---|---|
29 | 29 |
self.line = None |
30 | 30 |
return line |
31 | 31 |
|
32 |
def copy(from_, to): |
|
33 |
for line in StreamIter(from_): to.write(line) |
|
34 |
|
|
32 | 35 |
class TimeoutInputStream(WrapStream): |
33 | 36 |
'''@param timeout sec''' |
34 | 37 |
def __init__(self, stream, timeout): |
... | ... | |
38 | 41 |
def readline(self): |
39 | 42 |
return timeouts.run(lambda: self.stream.readline(), self.timeout) |
40 | 43 |
|
44 |
##### Traced streams |
|
45 |
|
|
41 | 46 |
class TracedStream(WrapStream): |
42 | 47 |
'''Wraps a stream, running a trace function on each string read or written |
43 | 48 |
''' |
Also available in: Unified diff
streams.py: Added copy(). Added section comment for traced streams.