
    Yfz	                         d Z ddlZddlZddlZddlmZ ddlmZmZ ddl	m
Z
mZ ddlmZ  G d d          Zej        fd	Zed
k    r e             dS dS )zj
Implementation of C{AMP} worker commands, and main executable entry point for
the workers.

@since: 12.3
    N)FileWrapper)startLoggingWithObservertextFromEventDict)_WORKER_AMP_STDIN_WORKER_AMP_STDOUT)WorkerOptionsc                       e Zd ZdZd Zd ZdS )WorkerLogObserverzF
    A log observer that forward its output to a C{AMP} protocol.
    c                     || _         dS )zg
        @param protocol: a connected C{AMP} protocol instance.
        @type protocol: C{AMP}
        N)protocol)selfr   s     Q/var/www/html/env/lib/python3.11/site-packages/twisted/trial/_dist/workertrial.py__init__zWorkerLogObserver.__init__   s    
 !    c                 z    ddl m} t          |          }|dS | j                            |j        |           dS )z'
        Produce a log output.
        r   )managercommandsN)out)twisted.trial._distr   r   r   
callRemote	TestWrite)r   	eventDictr   texts       r   emitzWorkerLogObserver.emit#   sQ     	877777 ++<F  !: EEEEEr   N)__name__
__module____qualname____doc__r   r    r   r   r
   r
      sA         ! ! !	F 	F 	F 	F 	Fr   r
   c                    t                      }|                                 ddlm}  ||d                   } | t          d          } | t
          d          }|                    t          |                     t          |          }t          |j
        d           	 	 |                    d          }n3# t          $ r&}|j        d         t          j        k    rY d	}~B d	}~ww xY w|d
k    rnf|                    |           |                                 t$          j                                         t$          j                                         |j        r^t%          j        d	           |j                                        }	|	                    dd|                                j                   d	S d	S )z
    Main function to be run if __name__ == "__main__".

    @param _fdopen: If specified, the function to use in place of C{os.fdopen}.
    @type _fdopen: C{callable}
    r   )WorkerProtocolzforce-gcrbwbFT   Nr   )show_missingsummarycoverdir)r   parseOptionstwisted.trial._dist.workerr    r   r   makeConnectionr   r
   r   r   readOSErrorargserrnoEINTRdataReceivedflushsysstdoutstderrtracersettraceresultswrite_resultsr&   path)
_fdopenconfigr    workerProtocol
protocolInprotocolOutobserverrer6   s
             r   mainrA   /   s    __F
999999#^F:$677N*D11J',d33K!!+k":":;;; 00HX]E222	""AA 	 	 	vayEK''		
 88''***JJ  } 
T-''))uv7H7H7M 	 	
 	
 	
 	
 	

 
s   $B: :
C*C%$C%%C*__main__)r   r-   osr1   twisted.internet.protocolr   twisted.python.logr   r   r   r   r   twisted.trial._dist.optionsr   r
   fdopenrA   r   r   r   r   <module>rH      s      				 



 1 1 1 1 1 1 J J J J J J J J E E E E E E E E 5 5 5 5 5 5F F F F F F F F0  *
 *
 *
 *
Z zDFFFFF r   