#NEWLINE# def __init__( self , * args , **kwargs ) : #NEWLINE# #INDENT# self . io_loop = ( kwargs . pop ( 'io_loop' , None ) or ioloop . IOLoop . current ( ) ) #NEWLINE# to_close = [ ] #NEWLINE# if ( kwargs . get ( 'stdin' ) is Subprocess . STREAM ) : #NEWLINE# #INDENT# ( in_r , in_w ) = _pipe_cloexec ( ) #NEWLINE# kwargs [ 'stdin' ] = in_r #NEWLINE# to_close . append ( in_r ) #NEWLINE# self . stdin = PipeIOStream ( in_w , io_loop = self . io_loop ) #NEWLINE# #UNINDENT# if ( kwargs . get ( 'stdout' ) is Subprocess . STREAM ) : #NEWLINE# #INDENT# ( out_r , out_w ) = _pipe_cloexec ( ) #NEWLINE# kwargs [ 'stdout' ] = out_w #NEWLINE# to_close . append ( out_w ) #NEWLINE# self . stdout = PipeIOStream ( out_r , io_loop = self . io_loop ) #NEWLINE# #UNINDENT# if ( kwargs . get ( 'stderr' ) is Subprocess . STREAM ) : #NEWLINE# #INDENT# ( err_r , err_w ) = _pipe_cloexec ( ) #NEWLINE# kwargs [ 'stderr' ] = err_w #NEWLINE# to_close . append ( err_w ) #NEWLINE# self . stderr = PipeIOStream ( err_r , io_loop = self . io_loop ) #NEWLINE# #UNINDENT# self . proc = subprocess . Popen ( * args , ** kwargs ) #NEWLINE# for fd in to_close : #NEWLINE# #INDENT# os . close ( fd ) #NEWLINE# #UNINDENT# for attr in [ 'stdin' , 'stdout' , 'stderr' , 'pid' ] : #NEWLINE# #INDENT# if ( not hasattr ( self , attr ) ) : #NEWLINE# #INDENT# setattr ( self , attr , getattr ( self . proc , attr ) ) #NEWLINE# #UNINDENT# #UNINDENT# self . _exit_callback = None #NEWLINE# self . returncode = None