Mercurial > kallithea
comparison rhodecode/lib/subprocessio.py @ 2730:7949bc80b3b1 beta
more py25 compat fixes
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 22 Aug 2012 13:30:52 +0200 |
parents | e9e7c40b4f1a |
children | fd5f2b217488 |
comparison
equal
deleted
inserted
replaced
2729:e9e7c40b4f1a | 2730:7949bc80b3b1 |
---|---|
23 If not, see <http://www.gnu.org/licenses/>. | 23 If not, see <http://www.gnu.org/licenses/>. |
24 ''' | 24 ''' |
25 import os | 25 import os |
26 import subprocess | 26 import subprocess |
27 import threading | 27 import threading |
28 from rhodecode.lib.compat import deque | 28 from rhodecode.lib.compat import deque, Event |
29 | 29 |
30 | 30 |
31 class StreamFeeder(threading.Thread): | 31 class StreamFeeder(threading.Thread): |
32 """ | 32 """ |
33 Normal writing into pipe-like is blocking once the buffer is filled. | 33 Normal writing into pipe-like is blocking once the buffer is filled. |
87 self.source = source | 87 self.source = source |
88 self.target = target | 88 self.target = target |
89 self.chunk_count_max = int(buffer_size / chunk_size) + 1 | 89 self.chunk_count_max = int(buffer_size / chunk_size) + 1 |
90 self.chunk_size = chunk_size | 90 self.chunk_size = chunk_size |
91 | 91 |
92 self.data_added = threading.Event() | 92 self.data_added = Event() |
93 self.data_added.clear() | 93 self.data_added.clear() |
94 | 94 |
95 self.keep_reading = threading.Event() | 95 self.keep_reading = Event() |
96 self.keep_reading.set() | 96 self.keep_reading.set() |
97 | 97 |
98 self.EOF = threading.Event() | 98 self.EOF = Event() |
99 self.EOF.clear() | 99 self.EOF.clear() |
100 | 100 |
101 self.go = threading.Event() | 101 self.go = Event() |
102 self.go.set() | 102 self.go.set() |
103 | 103 |
104 def stop(self): | 104 def stop(self): |
105 self.go.clear() | 105 self.go.clear() |
106 self.EOF.set() | 106 self.EOF.set() |