D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
lib
/
python3.9
/
site-packages
/
supervisor
/
__pycache__
/
Filename :
pidproxy.cpython-39.opt-1.pyc
back
Copy
a 0�g� � @ sL d Z ddlZddlZddlZddlZG dd� d�Zdd� ZedkrHe� dS )a pidproxy -- run command and proxy signals to it via its pidfile. This executable runs a command and then monitors a pidfile. When this executable receives a signal, it sends the same signal to the pid in the pidfile. Usage: %s <pidfile name> <command> [<cmdarg1> ...] � Nc @ s@ e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dS )�PidProxyNc C sb z4|d |dd � | _ }tj�|d �| _|| _W n( ttfy\ | �� t � d� Y n0 d S )N� � r )�pidfile�os�path�abspath�abscmd�cmdargs� ValueError� IndexError�usage�sys�exit)�self�argsr � r �7/usr/lib/python3.9/site-packages/supervisor/pidproxy.py�__init__ s zPidProxy.__init__c C sb | � � t�tj| j| j�| _t�d� zt� dtj �d }W n tyT d }Y n0 |rq^qd S )N� ���r )� setsignalsr �spawnv�P_NOWAITr r �pid�time�sleep�waitpid�WNOHANG�OSError)r r r r r �go s zPidProxy.goc C s t ttjd � d S )Nr )�print�__doc__r �argv�r r r r r ) s zPidProxy.usagec C st t � t j| j� t � t j| j� t � t j| j� t � t j| j� t � t j| j� t � t j| j� t � t j| j � d S �N) �signal�SIGTERM�passtochild�SIGHUP�SIGINT�SIGUSR1�SIGUSR2�SIGQUIT�SIGCHLD�reapr$ r r r r , s zPidProxy.setsignalsc C s d S r% r )r �sig�framer r r r/ 5 s z PidProxy.reapc C s� z@t | jd�� }t|�� �� �}W d � n1 s40 Y W n td| j � Y d S 0 t�||� |tj tj tjfv r�t� d� d S )N�rzCan't read child pidfile %s!r )�openr �int�read�stripr! r �killr&