#NEWLINE# def command( self , cmd , opts = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , callback = None ) : #NEWLINE# #INDENT# cmd = ( '%s %s %s' % ( self . git_path , cmd , ' ' . join ( opts . get ( 'args' ) ) ) ) #NEWLINE# cmd = shlex . split ( cmd ) #NEWLINE# if callback : #NEWLINE# #INDENT# p = subprocess . Popen ( cmd , stdin = subprocess . PIPE , stdout = subprocess . PIPE , stderr = subprocess . PIPE , close_fds = True ) #NEWLINE# data = opts . get ( 'msg' ) #NEWLINE# if data : #NEWLINE# #INDENT# p . stdin . write ( data ) #NEWLINE# #UNINDENT# return callback ( p ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# result = subprocess . check_output ( cmd ) #NEWLINE# #UNINDENT# except subprocess . CalledProcessError : #NEWLINE# #INDENT# result = None #NEWLINE# #UNINDENT# return result