#NEWLINE# def _read_shell_output( proc , no_filter , verbose , show_stdout , output_queue ) : #NEWLINE# #INDENT# stdout_buf = [ ] #NEWLINE# stderr_buf = [ ] #NEWLINE# if ( not no_filter ) : #NEWLINE# #INDENT# if ( verbose or show_stdout ) : #NEWLINE# #INDENT# for line in iter ( proc . stdout . readline , b'' ) : #NEWLINE# #INDENT# line = line . decode ( 'UTF-8' ) #NEWLINE# if ( ( line is not None ) and ( line != '' ) ) : #NEWLINE# #INDENT# if ( verbose or ( not _discard_line ( stderr_buf ) ) ) : #NEWLINE# #INDENT# ( sys . stdout . write ( line ) , ) #NEWLINE# stdout_buf . append ( line ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( not line ) or ( proc . returncode is not None ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if verbose : #NEWLINE# #INDENT# for line in iter ( proc . stderr . readline , b'' ) : #NEWLINE# #INDENT# line = line . decode ( 'UTF-8' ) #NEWLINE# if ( line != '' ) : #NEWLINE# #INDENT# ( sys . stdout . write ( line ) , ) #NEWLINE# stderr_buf . append ( line ) #NEWLINE# #UNINDENT# if ( not line ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# output_queue . put ( proc . communicate ( ) ) #NEWLINE# output_queue . put ( stdout_buf ) #NEWLINE# output_queue . put ( stderr_buf )