Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/twisted/runner/test/__pycache__/test_procmon.cpython-39.pyc
Ðазад
a k�h�a � @ s� d Z ddlZddlmZmZmZ ddlmZ ddlm Z ddl mZ ddlm Z mZ ddlmZ dd lmZ G d d� d�ZG dd � d ee�ZG dd� dej�ZG dd� dej�ZdS )z& Tests for L{twisted.runner.procmon}. � N)�ProcessDone�ProcessExitedAlready�ProcessTerminated)�Clock)�globalLogPublisher)�Failure)�LoggingProtocol�ProcessMonitor)� MemoryReactor)�unittestc @ s6 e Zd ZdZdZdZdZddd�Zdd� Zd d � Z dS )�DummyProcessa An incomplete and fake L{IProcessTransport} implementation for testing how L{ProcessMonitor} behaves when its monitored processes exit. @ivar _terminationDelay: the delay in seconds after which the DummyProcess will appear to exit when it receives a TERM signal � Nr c C s@ || _ || _|| _|| _|| _|| _|| _|| _| | _| | _ d S �N) �proto�_reactor�_executable�_args�_environment�_pathZ_uidZ_gidZ_usePTYZ _childFDs)�self�reactor� executable�args�environment�pathr �uid�gid�usePTY�childFDs� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/twisted/runner/test/test_procmon.py�__init__ s zDummyProcess.__init__c C sL | j dfdd�}| jdu r t� �||v rH|| \}}| j�|| j|�| _dS )a� A partial implementation of signalProcess which can only handle TERM and KILL signals. - When a TERM signal is given, the dummy process will appear to exit after L{DummyProcess._terminationDelay} seconds with exit code 0 - When a KILL signal is given, the dummy process will appear to exit immediately with exit code 1. @param signalID: The signal name or number to be issued to the process. @type signalID: C{str} r �r r )�TERM�KILLN)�_terminationDelay�pidr r Z callLater�processEndedZ_signalHandler)r ZsignalID�params�delay�statusr r r � signalProcess: s �zDummyProcess.signalProcessc C s, d| _ ttd�}| j�t|| |��� dS )zC Deliver the process ended event to C{self.proto}. Nr"