Fixed console to exit properly, wasn't finished frankly.

Script now exits as expected.
This commit is contained in:
Brian 2014-05-09 14:16:13 -06:00
parent 4bb145e4ca
commit b3b960e9ef
1 changed files with 10 additions and 8 deletions

View File

@ -93,11 +93,10 @@ class Console( threading.Thread ):
return self
def __exit__( self, type, value, tb ):
self.running = False
self.queue.put( ( Console.MSG.SHUTDOWN, ) )
self.queue.join( )
def run( self ):
# TODO: switch to a queue so we're not spinning and wasting a thread
self.running = True
while True:
data = self.queue.get( )
event = data[0]
@ -107,6 +106,8 @@ class Console( threading.Thread ):
for ( pid, buffer ) in self.buffers.iteritems( ):
for line in buffer:
print( line )
self.buffers.clear( )
self.queue.task_done( )
break
elif event == Console.MSG.WRITE:
@ -126,6 +127,8 @@ class Console( threading.Thread ):
if pid in self.buffers:
self.buffers.pop( pid, None )
self.queue.task_done( )
class Worker( threading.Thread ):
def __init__( self, console, queue, files_to_ignore ):
threading.Thread.__init__( self )
@ -247,7 +250,6 @@ def main( args ):
( options, args ) = parser.parse_args( )
root_full_path = os.getcwd( )
# Files are added from .p4ignore