ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python311/lib64/python3.11/__pycache__/subprocess.cpython-311.pyc

�

�f�Z���dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlmZ
ddlZ	ddlZn
#e$rdZYnwxYwgd�Z	ddlZdZn
#e$rdZYnwxYwejdvZerDddlZddlmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)e�*gd	���n@er*dd
l+m,Z-ej.Z/ej0Z1ej2Z3ej4Z5ej6Z7ndZ-dZ/dZ1dZ3dZ5dZ7ddl8Z8ddl9Z9Gd�de:��Z;Gd
�de;��Z<Gd�de;��Z=erGd�d��Z>Gd�de?��Z@n(eAe8dd��ZBeCe9d��re9jDZEne9jFZEerdZGd�ZHngZGd�ZHdZIdZJdZKd�ZLd�ZMd�ZNdd �d!�ZOd"�ZPdd �d#�ZQGd$�d%eR��ZSddddd&�d'�ZTd(�ZUddd)�d*�ZVddd)�d+�ZWd,�ZXeX��ZYdZZGd-�d.��Z[dS)/a�Subprocesses with accessible I/O streams

This module allows you to spawn processes, connect to their
input/output/error pipes, and obtain their return codes.

For a complete description of this module see the Python documentation.

Main API
========
run(...): Runs a command, waits for it to complete, then returns a
          CompletedProcess instance.
Popen(...): A class for flexibly executing a command in a new process

Constants
---------
DEVNULL: Special value that indicates that os.devnull should be used
PIPE:    Special value that indicates a pipe should be created
STDOUT:  Special value that indicates that stderr should go to stdout


Older API
=========
call(...): Runs a command, waits for it to complete, then returns
    the return code.
check_call(...): Same as call() but raises CalledProcessError()
    if return code is not 0
check_output(...): Same as check_call() but returns the contents of
    stdout instead of a return code
getoutput(...): Runs a command in the shell, waits for it to complete,
    then returns the output
getstatusoutput(...): Runs a command in the shell, waits for it to complete,
    then returns a (exitcode, output) tuple
�N)�	monotonic)�Popen�PIPE�STDOUT�call�
check_call�getstatusoutput�	getoutput�check_output�run�CalledProcessError�DEVNULL�SubprocessError�TimeoutExpired�CompletedProcessTF>�wasi�
emscripten)�CREATE_NEW_CONSOLE�CREATE_NEW_PROCESS_GROUP�STD_INPUT_HANDLE�STD_OUTPUT_HANDLE�STD_ERROR_HANDLE�SW_HIDE�STARTF_USESTDHANDLES�STARTF_USESHOWWINDOW�ABOVE_NORMAL_PRIORITY_CLASS�BELOW_NORMAL_PRIORITY_CLASS�HIGH_PRIORITY_CLASS�IDLE_PRIORITY_CLASS�NORMAL_PRIORITY_CLASS�REALTIME_PRIORITY_CLASS�CREATE_NO_WINDOW�DETACHED_PROCESS�CREATE_DEFAULT_ERROR_MODE�CREATE_BREAKAWAY_FROM_JOB)rrrrrrrr�STARTUPINFOrrrrr r!r"r#r$r%)�	fork_execc��eZdZdS)rN)�__name__�
__module__�__qualname__���1/opt/alt/python311/lib64/python3.11/subprocess.pyrr{s�������r-rc�V�eZdZdZdd�Zd�Zed���Zejd���ZdS)r
z�Raised when run() is called with check=True and the process
    returns a non-zero exit status.

    Attributes:
      cmd, returncode, stdout, stderr, output
    Nc�>�||_||_||_||_dS�N)�
returncode�cmd�output�stderr)�selfr2r3r4r5s     r.�__init__zCalledProcessError.__init__�s"��$�������������r-c���|jrS|jdkrHd|j�dtj|j���d�S#t$rd|j|jfzcYSwxYwd|j|jfzS)Nr�	Command 'z' died with �.z)Command '%s' died with unknown signal %d.z.Command '%s' returned non-zero exit status %d.)r2r3�signal�Signals�
ValueError�r6s r.�__str__zCalledProcessError.__str__�s����?�		/�t���2�2�
4�����&�.�$�/�1A�"B�"B�"B�"B�D�D���
4�
4�
4�B���4�?�"2�F4�4�4�4�4�
4����D��H�d�o�G/�/�
/s�%9�A�Ac��|jS)z+Alias for output attribute, to match stderr�r4r>s r.�stdoutzCalledProcessError.stdout�s���{�r-c��||_dSr1rA�r6�values  r.rBzCalledProcessError.stdout��������r-�NN�	r)r*r+�__doc__r7r?�propertyrB�setterr,r-r.r
r
~sy������������
/�
/�
/�����X���]����]���r-r
c�V�eZdZdZdd�Zd�Zed���Zejd���ZdS)rz�This exception is raised when the timeout expires while waiting for a
    child process.

    Attributes:
        cmd, output, stdout, stderr, timeout
    Nc�>�||_||_||_||_dSr1)r3�timeoutr4r5)r6r3rNr4r5s     r.r7zTimeoutExpired.__init__�s"���������������r-c�(�d|j�d|j�d�S)Nr9z' timed out after z seconds)r3rNr>s r.r?zTimeoutExpired.__str__�s�������4�<�<�<�)�	*r-c��|jSr1rAr>s r.rBzTimeoutExpired.stdout�s
���{�r-c��||_dSr1rArDs  r.rBzTimeoutExpired.stdout�rFr-rGrHr,r-r.rr�sy������������*�*�*�����X���]����]���r-rc�*�eZdZddddddd�d�Zd�ZdS)r&rN��dwFlags�	hStdInput�
hStdOutput�	hStdError�wShowWindow�lpAttributeListc�b�||_||_||_||_||_|pdgi|_dS)N�handle_listrS)r6rTrUrVrWrXrYs       r.r7zSTARTUPINFO.__init__�s>��"�D�L�&�D�N�(�D�O�&�D�N�*�D��#2�#I�}�b�6I�D� � � r-c���|j���}d|vrt|d��|d<t|j|j|j|j|j|���S)Nr[rS)	rY�copy�listr&rTrUrVrWrX)r6�	attr_lists  r.r]zSTARTUPINFO.copy�sk���,�1�1�3�3�I��	�)�)�+/�	�-�0H�+I�+I�	�-�(��t�|�)-��*.�/�)-��+/�+;�/8�:�:�:�
:r-)r)r*r+r7r]r,r-r.r&r&�sO������&'�4�D�#��D�	J�	J�	J�	J�	J�
	:�
	:�
	:�
	:�
	:r-r&c�6�eZdZdZejfd�Zd�Zd�ZeZ	dS)�HandleFc�<�|jsd|_||��dSdS)NT)�closed)r6�CloseHandles  r.�ClosezHandle.Close�s3���;�
"�"�����D�!�!�!�!�!�
"�
"r-c�Z�|jsd|_t|��Std���)NTzalready closed)rc�intr=r>s r.�Detachz
Handle.Detach�s.���;�
!�"����4�y�y� ��-�.�.�.r-c�>�d|jjt|��fzS)Nz%s(%d))�	__class__r)rgr>s r.�__repr__zHandle.__repr__�s���t�~�6��D�	�	�B�B�Br-N)
r)r*r+rc�_winapirdrerhrk�__del__r,r-r.rara�sU��������$+�$7�	"�	"�	"�	"�
	/�	/�	/�	C�	C�	C����r-ra�PIPE_BUFi�PollSelectorc��dSr1r,r,r-r.�_cleanuprqs���r-c���t�dStdd�D]P}|�tj���}|�,	t�|���@#t
$rY�LwxYw�QdS)N��
_deadstate)�_active�_internal_poll�sys�maxsize�remover=)�inst�ress  r.rqrqs����?��F��A�A�A�J�	�	�D��%�%���%�=�=�C�����N�N�4�(�(�(�(��!�����D������	�	s�A�
A&�%A&���������c�n�g}tjj}|dkr|�dd|zz��|S)zgReturn a list of command-line arguments reproducing the current
    optimization settings in sys.flags.r�-�O)rw�flags�optimize�append)�argsrEs  r.�"_optim_args_from_interpreter_flagsr�"s<���D��I��E��q�y�y����C�#��+�%�&�&�&��Kr-c��ddddddd�}t��}|���D]@\}}ttj|��}|dkr|�d	||zz���Atjjr|�d
��nrtjjr|�d��tjjr|�d��tjj	r|�d
��tj
dd�}ttdi��}tjj}tjj}|dkr|�
d��n|r|�
d��|r|�
d��|D]}|�d|z���|r|�d��dD]3}||vr-||}	|	dur|}
n|�d|	��}
|�d|
f���4|S)z}Return a list of command-line arguments reproducing the current
    settings in sys.flags, sys.warnoptions and sys._xoptions.�d�B�S�v�b�q)�debug�dont_write_bytecode�no_site�verbose�
bytes_warning�quietrr�z-Iz-Ez-sz-PN�	_xoptions�zerror::BytesWarningzdefault::BytesWarning�defaultz-W)�-X�dev)�faulthandler�tracemalloc�
importtime�frozen_modules�showrefcount�utf8T�=r�)r��items�getattrrwr�r��isolated�ignore_environment�no_user_site�	safe_path�warnoptionsr��dev_modery�extend)�flag_opt_mapr��flag�optr��warnopts�xoptionsr�r�rE�args           r.�_args_from_interpreter_flagsr�,s4��� #�����
�
�L�.�/�/�D�!�'�'�)�)�'�'�	��c��C�I�t�$�$���q�5�5��K�K��c�A�g�
�&�&�&��
�y������D������9�'�	��K�K������9�!�	��K�K������9��	��K�K�������q�q�q�!�H��s�K��,�,�H��I�+�M��y�!�H��q������-�.�.�.�.�	�1����/�0�0�0��#����	�"�"�"�� � �����D�3�J������#����M�"�"�"�:�%�%���(�?�?��S�M�E���}�}����!$���e�e�,���K�K��s��$�$�$���Kr-c�8�tjjrdtj��}|jj}d}|jx}r|jj|krn|dz
}|jx}�tjdt|��tjj
rdStj��S)N�r�z"'encoding' argument not specified.zutf-8)
rwr��warn_default_encoding�	_getframe�f_code�co_filename�f_back�warnings�warn�EncodingWarning�	utf8_mode�locale�getencoding)�f�filename�
stacklevels   r.�_text_encodingr�is����y�&�	3��M�O�O���8�'���
��8�m�a�	��x�#�x�/�/���!�O�J��8�m�a�	�	�
�:�%�z�	3�	3�	3��y��$��w��!�#�#�#r-�rNc��t|i|��5}	|�|���cddd��S#|����xYw#1swxYwYdS)z�Run command with arguments.  Wait for command to complete or
    timeout, then return the returncode attribute.

    The arguments are the same as for the Popen constructor.  Example:

    retcode = call(["ls", "-l"])
    r�N)r�wait�kill)rN�	popenargs�kwargs�ps    r.rr}s���
�	�	$�V�	$�	$���	��6�6�'�6�*�*����������	�
�F�F�H�H�H�����
������������s �A�1�A�A�A�Ac��t|i|��}|r/|�d��}|�|d}t||���dS)aORun command with arguments.  Wait for command to complete.  If
    the exit code was zero then return, otherwise raise
    CalledProcessError.  The CalledProcessError object will have the
    return code in the returncode attribute.

    The arguments are the same as for the call function.  Example:

    check_call(["ls", "-l"])
    r�Nr)r�getr
)r�r��retcoder3s    r.rr�sR���I�(��(�(�G��/��j�j�� � ���;��A�,�C� ��#�.�.�.��1r-c�@�dD]}||vrt|�d�����d|vrf|d�^|�d��s?|�d��s*|�d��s|�d��rd	}nd
}||d<t|t|dd�|��jS)
aRun command with arguments and return its output.

    If the exit code was non-zero it raises a CalledProcessError.  The
    CalledProcessError object will have the return code in the returncode
    attribute and output in the output attribute.

    The arguments are the same as for the Popen constructor.  Example:

    >>> check_output(["ls", "-l", "/dev/null"])
    b'crw-rw-rw- 1 root root 1, 3 Oct 18  2007 /dev/null\n'

    The stdout argument is not allowed as it is used internally.
    To capture standard error in the result, use stderr=STDOUT.

    >>> check_output(["/bin/sh", "-c",
    ...               "ls -l non_existent_file ; exit 0"],
    ...              stderr=STDOUT)
    b'ls: non_existent_file: No such file or directory\n'

    There is an additional optional argument, "input", allowing you to
    pass a string to the subprocess's stdin.  If you use this argument
    you may not also use the Popen constructor's "stdin" argument, as
    it too will be used internally.  Example:

    >>> check_output(["sed", "-e", "s/foo/bar/"],
    ...              input=b"when in the course of fooman events\n")
    b'when in the course of barman events\n'

    By default, all communication is in bytes, and therefore any "input"
    should be bytes, and the return value will be bytes.  If in text mode,
    any "input" should be a string, and the return value will be a string
    decoded according to locale encoding, or by "encoding" if set. Text mode
    is triggered by setting any of text, encoding, errors or universal_newlines.
    )rB�checkz- argument not allowed, it will be overridden.�inputN�universal_newlines�text�encoding�errors�r-T)rBrNr�)r=r�rrrB)rNr�r��kw�emptys     r.rr�s���F"�S�S��
��<�<���Q�Q�Q�R�R�R���&���V�G�_�4��:�:�*�+�+�	�v�z�z�&�/A�/A�	�V�Z�Z�PZ�E[�E[�	��:�:�h�'�'�	��E�E��E���w���	�$��t������� r-c�F�eZdZdZdd�Zd�Zeej��Z	d�Z
dS)raEA process that has finished running.

    This is returned by run().

    Attributes:
      args: The list or str args passed to run().
      returncode: The exit code of the process, negative for signals.
      stdout: The standard output (None if not captured).
      stderr: The standard error (None if not captured).
    Nc�>�||_||_||_||_dSr1)r�r2rBr5)r6r�r2rBr5s     r.r7zCompletedProcess.__init__�s"����	�$����������r-c��d�|j��d�|j��g}|j�-|�d�|j����|j�-|�d�|j����d�t
|��jd�|����S)Nz	args={!r}zreturncode={!r}zstdout={!r}zstderr={!r}z{}({})z, )	�formatr�r2rBr�r5�typer)�join)r6r�s  r.rkzCompletedProcess.__repr__�s����"�"�4�9�-�-�!�(�(���9�9�;���;�"��K�K�
�,�,�T�[�9�9�:�:�:��;�"��K�K�
�,�,�T�[�9�9�:�:�:����t�D�z�z�2�D�I�I�d�O�O�D�D�Dr-c�`�|jr&t|j|j|j|j���dS)z6Raise CalledProcessError if the exit code is non-zero.N)r2r
r�rBr5r>s r.�check_returncodez!CompletedProcess.check_returncode�s9���?�	2�$�T�_�d�i���%)�[�2�2�
2�	2�	2r-rG)r)r*r+rIr7rk�classmethod�types�GenericAlias�__class_getitem__r�r,r-r.rr�sh������	�	�����E�E�E�$��E�$6�7�7��2�2�2�2�2r-r)r��capture_outputrNr�c��|�.|�d���td���t|d<|rM|�d���|�d���td���t|d<t|d<t|i|��5}	|�||���\}}ny#t
$rW}	|���tr"|���\|	_|	_	n|�
���d}	~	w|����xYw|���}
|r|
rt|
|j
||����ddd��n#1swxYwYt|j
|
||��S)	a|Run command with arguments and return a CompletedProcess instance.

    The returned instance will have attributes args, returncode, stdout and
    stderr. By default, stdout and stderr are not captured, and those attributes
    will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
    or pass capture_output=True to capture both.

    If check is True and the exit code was non-zero, it raises a
    CalledProcessError. The CalledProcessError object will have the return code
    in the returncode attribute, and output & stderr attributes if those streams
    were captured.

    If timeout is given, and the process takes too long, a TimeoutExpired
    exception will be raised.

    There is an optional argument "input", allowing you to
    pass bytes or a string to the subprocess's stdin.  If you use this argument
    you may not also use the Popen constructor's "stdin" argument, as
    it will be used internally.

    By default, all communication is in bytes, and therefore any "input" should
    be bytes, and the stdout and stderr will be bytes. If in text mode, any
    "input" should be a string, and stdout and stderr will be strings decoded
    according to locale encoding, or by "encoding" if set. Text mode is
    triggered by setting any of text, encoding, errors or universal_newlines.

    The other arguments are the same as for the Popen constructor.
    N�stdinz/stdin and input arguments may not both be used.rBr5z@stdout and stderr arguments may not be used with capture_output.r��r4r5)r�r=rr�communicaterr��
_mswindowsrBr5r��pollr
r�r)r�r�rNr�r�r��processrBr5�excr�s           r.rr�s���<
���:�:�g���*��N�O�O�O���w��� ��:�:�h���+�v�z�z�(�/C�/C�/O��4�5�5�
5���x����x��	�	�	$�V�	$�	$�C��	�$�0�0���0�H�H�N�F�F�F���
	�
	�
	��L�L�N�N�N��

�*1�)<�)<�)>�)>�&��
�C�J�J������������	��L�L�N�N�N������,�,�.�.���	C�W�	C�$�W�g�l�,2�6�C�C�C�
C�/C�C�C�C�C�C�C�C�C�C�C����C�C�C�C�2�G�L�'�6�6�B�B�Bs7�E�B)�(E�)
D�3AD�D�3E�E"�%E"c��g}d}ttj|��D�]}g}|r|�d��d|vpd|vp|}|r|�d��|D]�}|dkr|�|���|dkr@|�dt	|��zdz��g}|�d���d|r|�|��g}|�|����|r|�|��|r*|�|��|�d����d�|��S)	a�
    Translate a sequence of arguments into a command line
    string, using the same rules as the MS C runtime:

    1) Arguments are delimited by white space, which is either a
       space or a tab.

    2) A string surrounded by double quotation marks is
       interpreted as a single argument, regardless of white space
       contained within.  A quoted string can be embedded in an
       argument.

    3) A double quotation mark preceded by a backslash is
       interpreted as a literal double quotation mark.

    4) Backslashes are interpreted literally, unless they
       immediately precede a double quotation mark.

    5) If backslashes immediately precede a double quotation mark,
       every pair of backslashes is interpreted as a literal
       backslash.  If the number of backslashes is odd, the last
       backslash escapes the next double quotation mark as
       described in rule 3.
    F� �	�"�\r�z\"r�)�map�os�fsdecoder��lenr�r�)�seq�result�	needquoter��bs_buf�cs      r.�list2cmdliner�@s~��<�F��I��2�;��$�$�!�!�����	��M�M�#�����C�Z�<�T�S�[�<��W�	��	��M�M�#�����	!�	!�A��D�y�y��
�
�a� � � � ��c����
�
�d�S��[�[�0��2�3�3�3����
�
�e�$�$�$�$�� ��M�M�&�)�)�)��F��
�
�a� � � � ��	"��M�M�&�!�!�!��	��M�M�&�!�!�!��M�M�#�����
�7�7�6�?�?�r-�r�r�c��	t|ddt||���}d}n%#t$r}|j}|j}Yd}~nd}~wwxYw|dd�dkr
|dd�}||fS)a�Return (exitcode, output) of executing cmd in a shell.

    Execute the string 'cmd' in a shell with 'check_output' and
    return a 2-tuple (status, output). The locale encoding is used
    to decode the output and process newlines.

    A trailing newline is stripped from the output.
    The exit status for the command can be interpreted
    according to the rules for the function 'wait'. Example:

    >>> import subprocess
    >>> subprocess.getstatusoutput('ls /bin/ls')
    (0, '/bin/ls')
    >>> subprocess.getstatusoutput('cat /bin/junk')
    (1, 'cat: /bin/junk: No such file or directory')
    >>> subprocess.getstatusoutput('/bin/junk')
    (127, 'sh: /bin/junk: not found')
    >>> subprocess.getstatusoutput('/bin/kill $$')
    (-15, '')
    T)�shellr�r5r�r�rNr|�
)rrr
r4r2)r3r�r��data�exitcode�exs      r.r	r	�s���*!��C�t�$�v�%-�f�>�>�>�������!�!�!��y���=�����������!�����B�C�C�y�D����C�R�C�y���T�>�s��
A�<�Ac�2�t|||���dS)a%Return output (stdout or stderr) of executing cmd in a shell.

    Like getstatusoutput(), except the exit status is ignored and the return
    value is a string containing the command's output.  Example:

    >>> import subprocess
    >>> subprocess.getoutput('ls /bin/ls')
    '/bin/ls'
    r�r�)r	)r3r�r�s   r.r
r
�s���3��&�A�A�A�!�D�Dr-c���tsttd��sdStjdvrdS	tjd��}|�d���}t|��dkrt�|d	}ttt|d�d
������}tjdkr|dkr|d
krdSn#tttf$rYnwxYwdS)a�Check if posix_spawn() can be used for subprocess.

    subprocess requires a posix_spawn() implementation that properly reports
    errors to the parent process, & sets errno on the following failures:

    * Process attribute actions failed.
    * File actions failed.
    * exec() failed.

    Prefer an implementation which can use vfork() in some cases for best
    performance.
    �posix_spawnF)�darwin�sunos5T�CS_GNU_LIBC_VERSIONr�)�maxsplitr�rr:�linux�glibc)r��)r��hasattrr�rw�platform�confstr�splitr�r=�tupler�rg�AttributeError�OSError)�ver�parts�libc�versions    r.�_use_posix_spawnr�s�������]�3�3���u�
�|�+�+�+��t�
��j�.�/�/���	�	�1�	�%�%���u�:�:��?�?����Q�x����C��q�����!4�!4�5�5�6�6���<�7�"�"�t�w���7�g�;M�;M��4���
�J��0�
�
�
���
����
�5s�B#C�C0�/C0c��eZdZdZdZ							d0dddddddddd�	d	�Zd
�Zeej	��Z
ed���Zej
d���Zd
�Zd�Zd�Zejejfd�Zd�Zd�Zd1d�Zd�Zd�Z	d2d�Zd3d�Zd�Zejd���Z e!r6d�Z"d�Z#d�Z$d�Z%de&j'e&j(e&j)fd�Z*d�Z+d �Z,d!�Z-d"�Z.d#�Z/e/Z0dSd$�Z"d%�Z1d&�Z%e2e3e4fd'�Z5de6e7e8j9fd(�Z*d)�Z:d*�Z+d+�Z-d,�Z;d-�Z.d.�Z/d/�Z0dS)4rar Execute a child program in a new process.

    For a complete description of the arguments see the Python documentation.

    Arguments:
      args: A string, or a sequence of program arguments.

      bufsize: supplied as the buffering argument to the open() function when
          creating the stdin/stdout/stderr pipe file objects

      executable: A replacement program to execute.

      stdin, stdout and stderr: These specify the executed programs' standard
          input, standard output and standard error file handles, respectively.

      preexec_fn: (POSIX only) An object to be called in the child process
          just before the child is executed.

      close_fds: Controls closing or inheriting of file descriptors.

      shell: If true, the command will be executed through the shell.

      cwd: Sets the current directory before the child is executed.

      env: Defines the environment variables for the new process.

      text: If true, decode stdin, stdout and stderr using the given encoding
          (if set) or the system default otherwise.

      universal_newlines: Alias of text, provided for backwards compatibility.

      startupinfo and creationflags (Windows only)

      restore_signals (POSIX only)

      start_new_session (POSIX only)

      process_group (POSIX only)

      group (POSIX only)

      extra_groups (POSIX only)

      user (POSIX only)

      umask (POSIX only)

      pass_fds (POSIX only)

      encoding and errors: Text mode encoding and error handling to use for
          file objects stdin, stdout and stderr.

    Attributes:
        stdin, stdout, stderr, pid, returncode
    Fr|NTrr,)	�user�group�extra_groupsr�r�r��umask�pipesize�
process_groupc	��ts'ttjtj�d����t
��tj��|_	d|_
d|_|�d}t|t��std���|�d}t|t��std���tr|�t!d���nF|r|st#jdt&��d	}|
�t!d
���|dkrt!d���||_d|_d|_d|_d|_d|_||_||_||_|�1|�/t;|��t;|��krt=d
���|p|p|p||_|jr|�tA��x|_}d|_!d|_"|jr
|dkrd	}d}nd}|�d}d}|��tGtHd��st!d���t|tJ��r>	ddl&}n#tN$rt!d���wxYw|�(|��j)}nGt|t��r|}n/td�*tW|�������|dkrt!d|�����d}|��+tGtHd��st!d���t|tJ��rt!d���g}|D]�}t|tJ��rQ	ddl&}n#tN$rt!d���wxYw|�,|�(|��j)���ht|t��r|�,|����td�*tW|�������|D]} | dkrt!d| ������d}!|��tGtHd��st!d���t|tJ��r>	ddl-}"n#tN$rt!d���wxYw|"�.|��j/}!n't|t��r|}!ntd���|!dkrt!d|!�����|�0|||��\}#}$}%}&}'}(tr�|$dkr'tcj2|$�3��d��}$|%dkr'tcj2|%�3��d��}%|'dkr'tcj2|'�3��d��}'	|$dkrEtij5|$d|��|_|jr#tij6|jd	|||� ��|_|%dkrCtij5|%d!|��|_|jr!tij6|j||�"��|_|'dkrCtij5|'d!|��|_|jr!tij6|j||�"��|_|�7||||||
||
||	|#|$|%|&|'|(||||!|||��dS#tqd|j|j|jf��D]'})	|)�9���#t$rY�$wxYw|j"s�g}*|ttkr|*�,|#��|ttkr|*�,|&��|ttkr|*�,|(��tG|d#��r|*�,|j;��|*D]X}+	tr*t|+tx��r|+�=��ntIj9|+���I#t$rY�UwxYw�xYw)$zCreate new Popen instance.z does not support processes.NFr|zbufsize must be an integerzpipesize must be an integerz0preexec_fn is not supported on Windows platformszpass_fds overriding close_fds.Tz2startupinfo is only supported on Windows platformsrz4creationflags is only supported on Windows platformszlCannot disambiguate when both text and universal_newlines are supplied but different. Pass one or the other.g�?r��setregidz>The 'group' parameter is not supported on the current platformzHThe group parameter cannot be a string on systems without the grp modulez,Group must be a string or an integer, not {}z!Group ID cannot be negative, got �	setgroupszEThe 'extra_groups' parameter is not supported on the current platformz#Groups must be a list, not a stringzIItems in extra_groups cannot be strings on systems without the grp modulez9Items in extra_groups must be a string or integer, not {}�setreuidz=The 'user' parameter is not supported on the current platformzGThe user parameter cannot be a string on systems without the pwd modulez#User must be a string or an integerz User ID cannot be negative, got �wb)�
write_through�line_bufferingr�r��rbr��_devnull)>�_can_fork_execr�errno�ENOTSUPrwrrq�	threading�Lock�
_waitpid_lock�_input�_communication_started�
isinstancerg�	TypeErrorr�r=r�r��RuntimeWarningr�r�rBr5�pidr2r�r�r�boolr�	text_moder��_sigint_wait_secs�_closed_child_pipe_fdsr
r��str�grp�ImportError�getgrnam�gr_gidr�r�r��pwd�getpwnam�pw_uid�_get_handles�msvcrt�open_osfhandlerh�io�open�
TextIOWrapper�_execute_child�filter�closerr%rare),r6r��bufsize�
executabler�rBr5�
preexec_fn�	close_fdsr��cwd�envr��startupinfo�
creationflags�restore_signals�start_new_session�pass_fdsrrrr�r�r�rrrr#�gidr7�gids�extra_group�	gid_check�uidr;�p2cread�p2cwrite�c2pread�c2pwrite�errread�errwriter��to_close�fds,                                            r.r7zPopen.__init__'s	���	���
�#�,�L�L�L���
�	�
�
�
�'�^�-�-������&+��#��?��G��'�3�'�'�	:��8�9�9�9����H��(�C�(�(�	;��9�:�:�:��	.��%� �"-�.�.�.�&�
�
!�	�
!��
�>��O�O�O� �	��&� �"-�.�.�.���!�!� �"-�.�.�.���	���
������������� ��
���� ��
�
��!3�!?��'�(�(�D��J�J�6�6�!�#F�G�G�
G�"�I�V�I�t�I�7I����>�	8�h�.�'5�'7�'7�7�D�M�H�
"&���&+��#��>�	'��!�|�|�!%�����!&��� ��M������2�z�*�*�
6� �"4�5�5�5��E�3�'�'�
6�J��J�J�J�J��"�J�J�J�$�&I�J�J�J�J�����l�l�5�)�)�0����E�3�'�'�
6����� N�!'���U���!4�!4�6�6�6��Q�w�w� �!J�S�!J�!J�K�K�K����#��2�{�+�+�
H� �"E�F�F�F��L�#�.�.�
H� �!F�G�G�G��D�+�
@�
@���k�3�/�/�@�7�"�
�
�
�
��&�7�7�7�(�*6�7�7�7�7����
�K�K����[� 9� 9� @�A�A�A�A���S�1�1�@��K�K��,�,�,�,�#�%9�%+�V�D��,=�,=�%>�%>�@�@�@�"�
V�
V�	��q�=�=�$�%T��%T�%T�U�U�U�!������2�z�*�*�
G� �"8�9�9�9��D�#�&�&�

G�J��J�J�J�J��"�J�J�J�$�&I�J�J�J�J�����l�l�4�(�(�/����D�#�&�&�
G����� E�F�F�F��Q�w�w� �!I�C�!I�!I�J�J�J�&#�/�/��v�v�F�F�	��(�	�(�	�(��	E��2�~�~�!�0����1B�1B�A�F�F���"�}�}� �/����0@�0@�!�D�D���"�}�}� �/����0@�0@�!�D�D��6	��2�~�~��W�X�t�W�=�=��
��>�>�!#�!1�$�*�D�+9�%-�f�">�">�">�D�J��"�}�}� �g�g�t�W�=�=����>�>�"$�"2�4�;�%-�f�#>�#>�#>�D�K��"�}�}� �g�g�t�W�=�=����>�>�"$�"2�4�;�%-�f�#>�#>�#>�D�K�
����j�*�i� (�#�s� +�]�E� '�� '�� '�� /� #�T�3�� 1�=�
B�
B�
B�
B�
B��	��D�4�:�t�{�D�K�"H�I�I�
�
����G�G�I�I�I�I�������D������.�
����D�=�=��O�O�G�,�,�,��T�>�>��O�O�H�-�-�-��T�>�>��O�O�H�-�-�-��4��,�,�3��O�O�D�M�2�2�2�"���B��%�)�*�R��*@�*@�)��H�H�J�J�J�J��H�R�L�L�L���"����������
���s{�H�H2�L�L7�P"�"P<�DY�&^�7Z�^�
Z�^�Z�B^�4A]:�9^�:
^�^�^�^c��d|jj�d|j�d|j�d�}t	|��dkr
|dd�dz}|S)N�<z: returncode: z args: �>�P�Lz...>)rjr)r2r�r�)r6�obj_reprs  r.rkzPopen.__repr__(sr��
B���'�
B�
B��?�
B�
B�37�9�
B�
B�
B�	��x�=�=�2�������}�v�-�H��r-c��|jSr1)r3r>s r.r�zPopen.universal_newlines3s���~�r-c�.�t|��|_dSr1)r2r3)r6r�s  r.r�zPopen.universal_newlines9s���0�1�1����r-c��|�||��}|�dd���dd��S)Nz
r��
)�decode�replace)r6r�r�r�s    r.�_translate_newlineszPopen._translate_newlines=s9���{�{�8�V�,�,���|�|�F�D�)�)�1�1�$��=�=�=r-c��|Sr1r,r>s r.�	__enter__zPopen.__enter__As���r-c�V�|jr|j���|jr|j���	|jr|j���|tkrA|jdkr-	|�|j���n#t$rYnwxYwd|_dS|���dS#|tkrC|jdkr-	|�|j���n#t$rYnwxYwd|_YdS|���wxYw)Nrr�)	rBrFr5r��KeyboardInterruptr4�_waitrr�)r6�exc_typerE�	tracebacks    r.�__exit__zPopen.__exit__Ds_���;�	 ��K�������;�	 ��K������	��z�
#��
� � �"�"�"��,�,�,��)�A�-�-���
�
�4�+A�
�B�B�B�B��)����������)*��&���
�I�I�K�K�K�K�K��#�,�,�,��)�A�-�-���
�
�4�+A�
�B�B�B�B��)����������)*��&�����
�I�I�K�K�K�K���sH� C�9B�
B"�!B"�D(�C8�7D(�8
D�D(�D�D(�D(c���|jsdS|j�|d|jzt|���|�|���|j�#t
�t
�|��dSdSdS)Nzsubprocess %s is still running)�sourcers)�_child_createdr2r1�ResourceWarningrvrur�)r6�_maxsize�_warns   r.rmz
Popen.__del__`s����"�	��F��?�"�
�E�2�T�X�=�!�$�
0�
0�
0�
0�	
���x��0�0�0��?�"�w�':��N�N�4� � � � � �#�"�':�':r-c��t|d��s.tjtjtj��|_|jS)Nr%)r
r�rB�devnull�O_RDWRr%r>s r.�_get_devnullzPopen._get_devnullos3���t�Z�(�(�	;��G�B�J��	�:�:�D�M��}�r-c�^�|rU	|j�|��n9#t$rYn-t$r!}|jtjkrn�Yd}~nd}~wwxYw	|j���dS#t$rYdSt$r"}|jtjkrn�Yd}~dSd}~wwxYwr1)r��write�BrokenPipeErrorrr'�EINVALrF)r6r�r�s   r.�_stdin_writezPopen._stdin_writets����	�
��
� � ��'�'�'�'��"�
�
�
����
�
�
��9���,�,����D�D�D�D�����
����	��J����������	�	�	��D�D��	�	�	��y�E�L�(�(�������������	���s7��
A�	A�A�A�A4�4
B,�	B,�
B'�'B,c��|jr|rtd���|��|js�|j|j|jg�d��dkr�d}d}|jr|�|��ns|jr3|j���}|j���n9|jr2|j���}|j���|�	��n�|�t��|z}nd}	|�|||��\}}np#t$rc|�)t|j|�|����}n|j}d|_	|�|���n#t"$rYnwxYw�wxYw	d|_n#d|_wxYw|�	|�|�����}||fS)a9Interact with process: Send data to stdin and close it.
        Read data from stdout and stderr, until end-of-file is
        reached.  Wait for process to terminate.

        The optional "input" argument should be data to be sent to the
        child process, or None, if no data should be sent to the child.
        communicate() returns a tuple (stdout, stderr).

        By default, all communication is in bytes, and therefore any
        "input" should be bytes, and the (stdout, stderr) will be bytes.
        If in text mode (indicated by self.text_mode), any "input" should
        be a string, and (stdout, stderr) will be strings decoded
        according to locale encoding, or by "encoding" if set. Text mode
        is triggered by setting any of text, encoding, errors or
        universal_newlines.
        z.Cannot send input after starting communicationNr�rr�T)r-r=r�rBr5�countr��readrFr��_time�_communicatero�minr4�_remaining_timerpr)r6r�rNrBr5�endtime�sigint_timeout�stss        r.r�zPopen.communicate�s&��$�&�	O�5�	O��M�N�N�N�

�O�D�$?�O�
�Z���d�k�2�8�8��>�>�!�C�C��F��F��z�
$��!�!�%�(�(�(�(���
$���)�)�+�+����!�!�#�#�#�#���
$���)�)�+�+����!�!�#�#�#��I�I�K�K�K�K��"��'�'�G�+�����
3�!%�!2�!2�5�'�7�!K�!K������$�

�

�

��&�%(��)?�)-�)=�)=�g�)F�)F�&H�&H�N�N�&*�%;�N�)*��&���J�J�~�J�6�6�6�6��%�����D������

�����"/3��+�+��d��+�2�2�2�2��)�)�D�$8�$8��$A�$A�)�B�B�C����sC�
D(�'F!�(AF�,F�F�
F�
F�F�F�F!�!	F*c�*�|���S)zSCheck if child process has terminated. Set and return returncode
        attribute.)rvr>s r.r�z
Popen.poll�s���"�"�$�$�$r-c�,�|�dS|t��z
S)z5Convenience for _communicate when computing timeouts.N)r�)r6r�s  r.r�zPopen._remaining_time�s���?��4��U�W�W�$�$r-c���|�dS|st��|krFt|j||rd�|��nd|rd�|��nd����dS)z2Convenience for checking if a timeout has expired.Nr-r�)r�rr�r�)r6r��orig_timeout�
stdout_seq�
stderr_seq�skip_check_and_raises      r.�_check_timeoutzPopen._check_timeout�s����?��F��	I�5�7�7�W�#4�#4� ��I�|�3=�G�3�8�8�J�/�/�/�4�3=�G�3�8�8�J�/�/�/�4�I�I�I�
I�$5�#4r-c�6�|�t��|z}	|�|���S#t$rc|�)t|j|�|����}n|j}d|_	|�|���n#t$rYnwxYw�wxYw)z=Wait for child process to terminate; returns self.returncode.Nr�r)r�rpror�r4r�r)r6rNr�r�s    r.r�z
Popen.wait�s������g�g��'�G�	��:�:�g�:�.�.�.�� �	�	�	�
�"�!$�T�%;�%)�%9�%9�'�%B�%B�"D�"D���"&�!7��%&�D�"�
��
�
�>�
�2�2�2�2��!�
�
�
���
�����	���s.�+�AB�/B�B�
B�B�B�Bc���t|dd��}tj��5}tra|dkr|�|j��|dkr|�|j��|dkr|�|j��n�|dkr,|dkr&||kr |�tj|��|dkr,|dkr&||kr |�tj|��|dkr,|dkr&||kr |�tj|��|� |�tj|��ddd��n#1swxYwYd|_dS)Nr%r|T)	r��
contextlib�	ExitStackr��callbackrer�rFr5)	r6rWrXrYrZr[r\�
devnull_fd�stacks	         r.�_close_pipe_fdszPopen._close_pipe_fdss���
�T�:�t�4�4�
�
�
!�
#�
#�	5�u��

7��b�=�=��N�N�7�=�1�1�1��r�>�>��N�N�8�>�2�2�2��r�>�>��N�N�8�>�2�2�2���b�=�=�X��^�^��:�8M�8M��N�N�2�8�W�5�5�5��r�>�>�g��m�m��J�8N�8N��N�N�2�8�X�6�6�6��r�>�>�g��m�m��J�8N�8N��N�N�2�8�X�6�6�6��%����r�x��4�4�4�#	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�('+��#�#�#s�D!E�E�Ec#�2K�g}	|V�dS#t|d��r|�|j��|`|D]X}	tr*t	|t
��r|���ntj|���I#t$rY�UwxYw�xYw)zCHelper to ensure file descriptors opened in _get_handles are closedr%N)
r
r�r%r�r.rarer�rFr)r6r]r^s   r.�_on_error_fd_closerzPopen._on_error_fd_closers�������	��N�N�N�N�N��	��t�Z�(�(�
"�����
�.�.�.��M��
�
���!�%�j��V�&<�&<�%����
�
�
�
��������������D��������s-��2B�AB�B�
B�B�B�Bc�	�|�|�|�dSd\}}d\}}d\}}	|���5}
|�qtjtj��}|�Ptjdd��\}}t|��}|
�|��tj|��n�|tkrNtjdd��\}}t|��t|��}}|
�	||f��n�|tkr'tj|�
����}nPt|t��rtj|��}n&tj|�����}|�|��}|�qtjtj��}|�Ptjdd��\}}t|��}|
�|��tj|��n�|tkrNtjdd��\}}t|��t|��}}|
�	||f��n�|tkr'tj|�
����}nPt|t��rtj|��}n&tj|�����}|�|��}|�qtjtj��}	|	�Ptjdd��\}}	t|	��}	|
�|	��tj|��n�|tkrNtjdd��\}}	t|��t|	��}	}|
�	||	f��n�|t(kr|}	n�|tkr'tj|�
����}	nPt|t��rtj|��}	n&tj|�����}	|�|	��}	ddd��n#1swxYwY||||||	fS)�|Construct and return tuple with IO objects:
            p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
            N)r|r|r|r|r|r|�r|r|r)r�rl�GetStdHandler�
CreatePiperar�rdrr�rr?�
get_osfhandler}r.rg�fileno�_make_inheritablerrr)r6r�rBr5rWrXrYrZr[r\�
err_close_fds�_s            r.r>zPopen._get_handles7sd���}���F�N�/�/� &��G�X� &��G�X� &��G�X��)�)�+�+�=
<�}��=�%�2�7�3K�L�L�G���%,�%7��a�%@�%@�
���"(��/�/��%�,�,�W�5�5�5��+�A�.�.�.���d�]�]�(/�(:�4��(C�(C�%�G�X�(.�w�����9I�9I�X�G�!�(�(�'�8�)<�=�=�=�=��g�%�%�$�2�4�3D�3D�3F�3F�G�G�G�G���s�+�+�C�$�2�5�9�9�G�G�%�2�5�<�<�>�>�B�B�G��0�0��9�9���>�&�3�G�4M�N�N�H��'�&-�&8��q�&A�&A���8�#)�(�#3�#3��%�,�,�X�6�6�6��+�A�.�.�.���t�^�^�(/�(:�4��(C�(C�%�G�X�(.�w�����9I�9I�X�G�!�(�(�'�8�)<�=�=�=�=��w�&�&�%�3�D�4E�4E�4G�4G�H�H�H�H����,�,�E�%�3�F�;�;�H�H� &�3�F�M�M�O�O�D�D�H��1�1�(�;�;���>�&�3�G�4L�M�M�H��'�&-�&8��q�&A�&A���8�#)�(�#3�#3��%�,�,�X�6�6�6��+�A�.�.�.���t�^�^�(/�(:�4��(C�(C�%�G�X�(.�w�����9I�9I�X�G�!�(�(�'�8�)<�=�=�=�=��v�%�%�'�H�H��w�&�&�%�3�D�4E�4E�4G�4G�H�H�H�H����,�,�E�%�3�F�;�;�H�H� &�3�F�M�M�O�O�D�D�H��1�1�(�;�;��{=
<�=
<�=
<�=
<�=
<�=
<�=
<�=
<�=
<�=
<�=
<����=
<�=
<�=
<�=
<�~�X��X��X�'�
's�P8Q0�0Q4�7Q4c��tjtj��|tj��ddtj��}t	|��S)z2Return a duplicate of handle, which is inheritablerr�)rl�DuplicateHandle�GetCurrentProcess�DUPLICATE_SAME_ACCESSra)r6�handle�hs   r.r�zPopen._make_inheritable�sF���'��)�+�+�V��)�+�+�Q���-�/�/�A��!�9�9�r-c�4�td�|D����S)z�Filter out console handles that can't be used
            in lpAttributeList["handle_list"] and make sure the list
            isn't empty. This also removes duplicate handles.c�h�h|]/}|dzdks"tj|��tjk�-|��0S)�)rl�GetFileType�FILE_TYPE_CHAR)�.0r�s  r.�	<setcomp>z,Popen._filter_handle_list.<locals>.<setcomp>�sT��4�4�4�F�"�S�L�C�/�/�#�/��7�7�#�2�3�3� �3�3�3r-)r^)r6r[s  r.�_filter_handle_listzPopen._filter_handle_list�s1���4�4�k�4�4�4�5�5�
5r-c�N�|r
Jd���t|t��rn�t|t��r"|
rtd���t	|g��}nKt|t
j��r"|
rtd���t	|g��}nt	|��}|�tj|��}|�t��}n|�	��}d|||fv}|r/|xj
tjzc_
||_
||_||_|j}t#|od|vo|d��}|s|r�|r�|�	ix}|_t%|�dg����x}|d<|r/|t)|��t)|��t)|��gz
}|�|��|dd�<|r|st-jdt0��d}|
r�|xj
tjzc_
tj|_|s�t
j�d	��}|sot
j�d
d��}t
j�|dd
��}t
j�|��stAd���t
j�|��r|}n|}d�!||��}|�tj|��}tEj#d||||��	tj$||ddt)|��|	|||�	�	\}}} }!|�%|||
|||��n#|�%|||
|||��wxYwd|_&tO|��|_(| |_)tj*|��dS)z$Execute program (MS Windows version)z"pass_fds not supported on Windows.z$bytes args is not allowed on Windows�0path-like args is not allowed when shell is trueNr|r[z?startupinfo.lpAttributeList['handle_list'] overriding close_fdsF�ComSpec�
SystemRootr��System32zcmd.exez:shell not found: neither %ComSpec% nor %SystemRoot% is setz
{} /c "{}"�subprocess.PopenT)+r.r6�bytesr/r�r��PathLiker�r&r]rTrlrrUrVrWrYr2r^r�rgr�r�r�r0rrrX�environ�pathr��isabs�FileNotFoundErrorr�rw�audit�
CreateProcessr�rvra�_handler1rd)"r6r�rHrIrJrQrKrLrMrNr�rWrXrYrZr[r\�unused_restore_signals�
unused_gid�unused_gids�
unused_uid�unused_umask�unused_start_new_session�unused_process_group�use_std_handles�attribute_list�have_handle_listr[�comspec�system_root�hp�htr1�tids"                                  r.rDzPopen._execute_child�s�� �E�E�!E�E�E�<��$��$�$�
*���D�%�(�(�

*��L�#�$J�K�K�K�#�T�F�+�+����D�"�+�.�.�
*��5�#�%4�5�5�5�#�T�F�+�+���#�D�)�)���%��[��4�4�
��"�)�m�m���*�.�.�0�0�� ��(�H�(E�E�O��
1��#�#�w�'C�C�#�#�(/��%�)1��&�(0��%�(�8�N�#�N�%B�$1�^�$C�%B�$2�=�$A� C� C��
 �
&�O�
&�	�
&�!�)�CE�E�N�[�%@���+�+�M�2�>�>�?�?�@��n�]�;�#�P��C��L�L�#�h�-�-��X���#O�O�K�!%�!9�!9�+�!F�!F��A�A�A���&�$�N� �
�'=�>L�N�N�N�!&�I��
;��#�#�w�'C�C�#�#�*1�/��'�!�)�!�j�n�n�Y�7�7�G�"�r�&(�j�n�n�\�2�&F�&F��"$�'�,�,�{�J�	�"R�"R��!�w�}�}�W�5�5�r�"3�4p�"q�"q�q��w�}�}�W�-�-�-�%,�
��(�G�#�*�*�G�T�:�:�����k�#�&�&���I�(�*�d�C��E�E�E�
8�#*�#8��T�)-�t�),��]�);�);�)6�),�),�)4�$6�$6� ��B��S��$�$�W�h�%,�h�%,�h�8�8�8�8���$�$�W�h�%,�h�%,�h�8�8�8�8����
#'�D��!�"�:�:�D�L��D�H����#�#�#�#�#s�/M�M,c�r�|j�*||jd��|kr||j��|_|jS)z�Check if child process has terminated.  Returns returncode
            attribute.

            This method is called by __del__, so it can only refer to objects
            in its local scope.

            Nr)r2r�)r6rt�_WaitForSingleObject�_WAIT_OBJECT_0�_GetExitCodeProcesss     r.rvzPopen._internal_pollsB����&�'�'���a�8�8�N�J�J�&9�&9�$�,�&G�&G�D�O��?�"r-c�,�|�
tj}n|dkrd}nt|dz��}|j�]tj|j|��}|tjkrt|j|���tj	|j��|_|jS)z-Internal implementation of wait() on Windows.Nri�)
rl�INFINITErgr2�WaitForSingleObjectr��WAIT_TIMEOUTrr��GetExitCodeProcess)r6rN�timeout_millisr�s    r.rpzPopen._wait,s�����!(�!1����A���!"���!$�W�t�^�!4�!4����&� �4�T�\�5C�E�E���W�1�1�1�(���G�<�<�<�")�"<�T�\�"J�"J����?�"r-c�|�|�|�����|���dSr1)r�r�rF)r6�fh�buffers   r.�
_readerthreadzPopen._readerthread>s-���M�M�"�'�'�)�)�$�$�$��H�H�J�J�J�J�Jr-c�Z�|jrht|d��sXg|_tj|j|j|jf���|_d|j_|j���|j	rht|d��sXg|_
tj|j|j	|j
f���|_d|j_|j���|jr|�
|��|j�[|j�|�|����|j���rt#|j|���|j	�[|j�|�|����|j���rt#|j|���d}d}|jr |j}|j���|j	r |j
}|j	���|r|dnd}|r|dnd}||fS)N�_stdout_buff)�targetr�T�_stderr_buffr)rBr
r�r)�Threadr��
stdout_thread�daemon�startr5r��
stderr_threadr�r�r�r��is_aliverr�rF)r6r�r�r�rBr5s      r.r�zPopen._communicateCsI���{�
+�7�4��#@�#@�
+�$&��!�!�(��0B�/3�{�D�<M�.N�P�P�P��"�-1��"�)��"�(�(�*�*�*��{�
+�7�4��#@�#@�
+�$&��!�!�(��0B�/3�{�D�<M�.N�P�P�P��"�-1��"�)��"�(�(�*�*�*��z�
)��!�!�%�(�(�(�
�{�&��"�'�'��(<�(<�W�(E�(E�F�F�F��%�.�.�0�0�B�(���L�A�A�A��{�&��"�'�'��(<�(<�W�(E�(E�F�F�F��%�.�.�0�0�B�(���L�A�A�A��F��F��{�
$��*����!�!�#�#�#��{�
$��*����!�!�#�#�#�#)�2�V�A�Y�Y�d�F�"(�2�V�A�Y�Y�d�F��F�#�#r-c�|�|j�dS|tjkr|���dS|tjkr&tj|jtj��dS|tjkr&tj|jtj��dStd�
|�����)�Send a signal to the process.NzUnsupported signal: {})r2r;�SIGTERM�	terminate�CTRL_C_EVENTr�r�r1�CTRL_BREAK_EVENTr=r��r6�sigs  r.�send_signalzPopen.send_signalus�����*����f�n�$�$���� � � � � ���+�+�+�����&�"5�6�6�6�6�6���/�/�/�����&�"9�:�:�:�:�:� �!9�!@�!@��!E�!E�F�F�Fr-c���|j�dS	tj|jd��dS#t$r5tj|j��}|tjkr�||_YdSwxYw)zTerminates the process.Nr�)r2rl�TerminateProcessr��PermissionErrorr��STILL_ACTIVE)r6�rcs  r.r�zPopen.terminate�s~����*���
%��(���q�9�9�9�9�9��"�
%�
%�
%��/���=�=����-�-�-��"$������

%���s�'�;A&�%A&c��d\}}d\}}d\}}	|���5}
|�n�|tkrstj��\}}|
�||f��|jdkr:t
td��r%tj|tj|j��nL|tkr|�
��}n,t|t��r|}n|�
��}|�n�|tkrstj��\}}|
�||f��|jdkr:t
td��r%tj|tj|j��nL|tkr|�
��}n,t|t��r|}n|�
��}|�n�|tkrstj��\}}	|
�||	f��|jdkr:t
td��r%tj|	tj|j��n|tkr(|dkr|}	nktj�
��}	nL|tkr|�
��}	n,t|t��r|}	n|�
��}	ddd��n#1swxYwY||||||	fS)r�r�Nr�F_SETPIPE_SZr|)r�rr��piper�rr
�fcntlr�rr}r.rgr�rrw�
__stdout__)r6r�rBr5rWrXrYrZr[r\r�s           r.r>zPopen._get_handles�s���!'��G�X� &��G�X� &��G�X��)�)�+�+�1
/�}��=���d�]�]�(*��	�	�%�G�X�!�(�(�'�8�)<�=�=�=��}�q�(�(�W�U�N�-K�-K�(���H�e�.@�$�-�P�P�P���g�%�%�"�/�/�1�1�G�G���s�+�+�-�#�G�G�$�l�l�n�n�G��>���t�^�^�(*��	�	�%�G�X�!�(�(�'�8�)<�=�=�=��}�q�(�(�W�U�N�-K�-K�(���H�e�.@�$�-�P�P�P���w�&�&�#�0�0�2�2�H�H����,�,�/�%�H�H� &�}�}���H��>���t�^�^�(*��	�	�%�G�X�!�(�(�'�8�)<�=�=�=��}�q�(�(�W�U�N�-K�-K�(���H�e�.@�$�-�P�P�P���v�%�%��2�~�~�#+���#&�>�#8�#8�#:�#:����w�&�&�#�0�0�2�2�H�H����,�,�/�%�H�H� &�}�}���H�c1
/�1
/�1
/�1
/�1
/�1
/�1
/�1
/�1
/�1
/�1
/����1
/�1
/�1
/�1
/�f�X��X��X�'�
's�JK�K�Kc���|�tj}i}|r9g}dD]/}
tt|
d��}|�|�|���0||d<g}|||	fD])}|dkr!|�tj|f���*|df|df|
dffD]-\}}|dkr"|�tj||f���.|r||d<tj|||fi|��|_d	|_	|�
|||||	|
��dS)
z'Execute program using os.posix_spawn().N)�SIGPIPE�SIGXFZ�SIGXFSZ�	setsigdefr|rr�r��file_actionsT)r�r�r�r;r��POSIX_SPAWN_CLOSE�POSIX_SPAWN_DUP2rr1rvr�)r6r�rHrLrOrWrXrYrZr[r\r��sigset�signame�signumrr^�fd2s                  r.�_posix_spawnzPopen._posix_spawn�se��
�{��j���F��
-���?�.�.�G�$�V�W�d�;�;�F��)��
�
�f�-�-�-��&,��{�#��L���'�2�
D�
D����8�8� �'�'��)=�r�(B�C�C�C���!���1�
��1�
��
H�
H���C�
��8�8� �'�'��)<�b�#�(F�G�G�G���
6�)5��~�&��~�j�$��F�F�v�F�F�D�H�"&�D��� � ��(�!(�(�!(�(�
4�
4�
4�
4�
4r-c�V
��t|ttf��r|g}n>t|tj��r|
rtd���|g}nt
|��}|
r'ttd��rdnd}|dg|z}�r�|d<��|d�tj	d�|||��trtj����r`|�^|s\|sZ|�X|d	ks|d
krL|d	ks|d
kr@|d	ks|d
kr4|s2|d	kr,|�*|�(|�&|dkr |�
|�|||||
|||�
�
dS�}tj��\}}g}|dkr/|�|��tj|��}|dk�/|D]}tj|���		|�qg}|���D]Y\}} tj|��}d|vrt)d
���|�|dztj| ��z���Znd}tj����tj����r�f}!n-t+�fd�tj|��D����}!t/|��}"|"�|��t3||!|t+t5t7t8|"������|||||
|||||||||||||t:��|_d|_tj|��n#tj|��wxYw|� |||
|||��tC��}#	tj"|d��}$|#|$z
}#|$rtG|#��dkrn�1	tj|��n#tj|��wxYw|#�rt	tj$|jd��\}%}&|%|jkr|�%|&��ntj&|_'n#tP$rYnwxYw	|#�)dd
��\}'}(})|)�*��})n6#t($r)d}'d}(d�+t|#����})YnwxYwtYtZ|'�*d��t\��}*t_|*t`��r_|(r]t9|(d��}+|)dkrd})|},n
|)dkrd})d},n|},|+dkrtj1|+��})|,�
|*|+|)|,���|*|+|)���|*|)���dS)zExecute program (POSIX version)r��getandroidapilevelz/system/bin/shz/bin/shz-crNr�r|r�r��=z!illegal environment variable namec3�|�K�|]6}tj�tj|�����V��7dSr1)r�r�r��fsencode)r��dirrHs  �r.�	<genexpr>z'Popen._execute_child.<locals>.<genexpr>XsQ�����0>�0>� #��G�L�L���S�)9�)9�:�F�F�0>�0>�0>�0>�0>�0>r-TiP��:sSubprocessError�0z#Bad exception data from child: {!r}�ascii�znoexec:chdirr��noexec)2r.r6r�r�r�r/r^r
rwr��_USE_POSIX_SPAWNr��dirnamerr�r��duprFr�rr=r�
get_exec_path�set�add�
_fork_exec�sortedr�rg�
_USE_VFORKr1rvr��	bytearrayr�r��waitpid�_handle_exitstatusrxr2�ChildProcessErrorr
rir�r��builtinsr�
issubclassr�strerror)-r6r�rHrIrJrQrKrLrMrNr�rWrXrYrZr[r\rOrRrSrVrrPr�
unix_shell�orig_executable�errpipe_read�
errpipe_write�low_fds_to_close�low_fd�env_list�kr��executable_list�fds_to_keep�errpipe_data�partr1r��exception_name�	hex_errno�err_msg�child_exception_type�	errno_num�err_filenames-  `                                          r.rDzPopen._execute_child�sX����$��e��-�-�
"��v����D�"�+�.�.�
"��5�#�%4�5�5�5��v����D�z�z���
)�"�#�';�<�<�L�.�.�BK��"�D�)�D�0���)�(�D��G��!�!�!�W�
��I�(�*�d�C��E�E�E� �
�����
�3�3�
�"�*�%�+�$�+��� �B���'�A�+�+�!�R���8�a�<�<�!�R���8�a�<�<�-�,8�%��+�+���������	�	��!�!�$�
�C��")�8�")�8�")�8�5�5�5���(�O�
+-�'�)�)�'�L�-�!���!�#�#� �'�'�
�6�6�6� "��}� 5� 5�
� �!�#�#�+�
!�
!����� � � � �7
'�&,���#%��$'�I�I�K�K�G�G�D�A�q� "��A���A�#�q�y�y�&0�1T�&U�&U� U�$�O�O�A��H�r�{�1�~�~�,E�F�F�F�F�	G�$(��!#��Z�!8�!8�J��w���z�2�2�>�+5�-���+0�0>�0>�0>�0>�')�'7��'<�'<�0>�0>�0>�+>�+>��#&�h�-�-�K��O�O�M�2�2�2�)� �/�%�u�V�C��[�4I�4I�-J�-J�'K�'K���#�X�w��#�X�(�-�+�->�)�3��c�5�&�
�	 4�	 4�D�H�+/�D�'��H�]�+�+�+�+��B�H�]�+�+�+�+�����$�$�W�h�%,�h�%,�h�8�8�8� )�{�{����7�<��7�7�D� �D�(�L���3�|�#4�#4�u�#<�#<��	�����&�&�&�&�����&�&�&�&�����*
4��!�z�$�(�A�6�6�H�C���d�h����/�/��4�4�4�4�*-�+�����(�����D�����7�(�.�.�t�Q�7�7�7�N�I�w�
&�n�n�.�.�G�G��!�7�7�7�%7�N� $�I�C�J�J�"'��"5�"5�7�7�G�G�G�7����
(/� �.�"7�"7��"@�"@�'�()�()�$��2�G�<�<�G��G� #�I�r� 2� 2�I��.�0�0�"$��'*��� �H�,�,�"$��'+���'6�� �A�~�~�"$�+�i�"8�"8��#�/�2�2�9�g�|�T�T�T�2�2�9�g�F�F�F�*�*�7�3�3�3�U*
4�*
4sE�E L�;N�L&�&AN�N/�6AP�
P�P�.Q�0Q9�8Q9c�b�||��r||��|_dS||��|_dS)�:All callers to this function MUST hold self._waitpid_lock.N)r2)r6r��_waitstatus_to_exitcode�_WIFSTOPPED�	_WSTOPSIGs     r.r$zPopen._handle_exitstatus�sA���{�3���
?�#,�9�S�>�>�/�����"9�"9�#�">�">����r-c���|j��|j�d��sdS	|j� |j|j���S||j|��\}}||jkr|�|��n3#t$r&}|�||_n|j|krd|_Yd}~nd}~wwxYw|j���n#|j���wxYw|jS)z�Check if child process has terminated.  Returns returncode
            attribute.

            This method is called by __del__, so it cannot reference anything
            outside of the local scope (nor can any methods it calls).

            NFr)r2r+�acquire�releaser1r$rr')r6rt�_waitpid�_WNOHANG�_ECHILDr1r��es        r.rvzPopen._internal_poll�s����&��)�1�1�%�8�8� � �4�1���2�#���&�.�.�0�0�0�0� (�x���(�;�;�H�C���d�h����/�/��4�4�4����	,�	,�	,�!�-�*4������G�+�+�+,������������	,�����&�.�.�0�0�0�0��D�&�.�.�0�0�0�0�����?�"s5�
B�4B�C�
B1�B,�'C�,B1�1C�C)c�z�	tj|j|��\}}n#t$r|j}d}YnwxYw||fS)r<r)r�r#r1r%)r6�
wait_flagsr1r�s    r.�	_try_waitzPopen._try_wait�sY��
��Z���*�=�=�
��c�c��$�
�
�
��h������
������:�s� �6�6c���|j�|jS|��Vt��|z}d}	|j�d��r�	|j�	|j����n}|�tj��\}}||jks|dksJ�||jkr1|�	|��	|j����n	|j���n#|j���wxYw|�
|��}|dkrt|j|���t|dz|d��}tj|����B|j�r|j5|j�
	ddd��nV|�d��\}}||jkr|�	|��ddd��n#1swxYwY|j�r|jS)z+Internal implementation of wait() on POSIX.Ng����Mb@?TFrr�g�������?)r2r�r+rArBrIr��WNOHANGr1r$r�rr�r��time�sleep)r6rNr��delayr1r��	remainings       r.rpzPopen._wait�sT����*���&��"��'�'�G�+����&��)�1�1�%�8�8�
9�	9�#��:� %�!�.�6�6�8�8�8�8�
*.����
�)C�)C�J�S�#�#&�$�(�?�?�c�Q�h�h�h�#>�"�d�h��� $� 7� 7�� <� <� <� %� �.�6�6�8�8�8�8�	 /�!�.�6�6�8�8�8�8��D�.�6�6�8�8�8�8���� $� 4� 4�W� =� =�I� �A�~�~�,�T�Y��@�@�@����	�9�c�:�:�E��J�u�%�%�%�!&�$�o�-��+�9�9��?�6�!�9�9�9�9�9�9�9�&*�^�^�A�%6�%6�
��c��$�(�?�?� �3�3�C�8�8�8�9�9�9�9�9�9�9�9�9�9�9����9�9�9�9��o�-��?�"s+�C0�$AC0�0D�6	G�8G�G�Gc�<	�|jr_|jsX	|j���n#t$rYnwxYw|s+	|j���n#t$rYnwxYwd}d}|js3i|_|jrg|j|j<|jrg|j|j<|jr|j|j}|jr|j|j}|�|��|j	rt|j	��}t��5}|jr'|r%|�|jtj��|jr1|jjs%|�|jtj��|jr1|jjs%|�|jtj��|����r|�|��}|�/|dkr)|�||||d���t)d���|�|��}	|�||||��|	D�]v\}
}|
j|jur�||j|jt0z�}	|xjt3j|
j|��z
c_|jt9|j	��kr3|�|
j��|
j�����#t$r6|�|
j��|
j���Y��wxYw|
j|j|jfvrtt3j|
jd��}
|
s3|�|
j��|
j���|j|
j�|
����x|�����ddd��n#1swxYwY|� |�|�����|�d�!|��}|�d�!|��}|j"rZ|�+|�#||jj$|jj%��}|�+|�#||jj$|jj%��}||fS)NrT)r�zN_check_timeout(..., skip_check_and_raise=True) failed to raise TimeoutExpired.i�r�r-)&r�r-�flushr�rF�_fileobj2outputrBr5�_save_inputr,�
memoryview�_PopenSelector�register�	selectors�EVENT_WRITErc�
EVENT_READ�get_mapr�r��RuntimeError�select�fileobj�
_input_offset�	_PIPE_BUFr�rr^r��
unregisterr�r�r�r�r3rkr�r�)r6r�r�r�rBr5�
input_view�selectorrN�ready�key�events�chunkr�s              r.r�zPopen._communicatesU���z�
�$�"=�
���J�$�$�&�&�&�&��&�����D���������
�(�(�*�*�*�*��*�����������F��F��.�
;�')��$��;�;�8:�D�(���5��;�;�8:�D�(���5��{�
;��-�d�k�:���{�
;��-�d�k�:�����U�#�#�#��{�
5�'���4�4�
��!�!�*
K�X��:�I�%�I��%�%�d�j�)�2G�H�H�H��;�I�t�{�'9�I��%�%�d�k�9�3G�H�H�H��;�I�t�{�'9�I��%�%�d�k�9�3G�H�H�H��&�&�(�(�"K�"�2�2�7�;�;�G��*�w��{�{��+�+�G�\�,2�F�AE�,�G�G�G�+�>�?�?�?�%�O�O�G�4�4�E��'�'���v�v�N�N�N�
(-�K�K���V��;�$�*�4�4�$.�t�/A�/3�/A�I�/M�0N�%O�E�8� $� 2� 2�b�h�s�v�u�6M�6M� M� 2� 2�
$(�#5��T�[�9I�9I�#I�#I�$,�$7�$7���$D�$D�$D�$'�K�$5�$5�$7�$7�$7���
$3�4�4�4� (� 3� 3�C�K� @� @� @� #�� 1� 1� 3� 3� 3� 3� 3�4����!�[�T�[�$�+�,F�F�F�#%�7�3�6�5�#9�#9�D�#'�4� (� 3� 3�C�K� @� @� @� #�� 1� 1� 3� 3� 3� �0���=�D�D�T�J�J�J��E�&�&�(�(�"K�*
K�*
K�*
K�*
K�*
K�*
K�*
K�*
K�*
K�*
K�*
K����*
K�*
K�*
K�*
K�X
�I�I�d�2�2�7�;�;�I�<�<�<��!����&�)�)���!����&�)�)���~�
J��%�!�5�5�f�6:�k�6J�6:�k�6H�J�J�F��%�!�5�5�f�6:�k�6J�6:�k�6H�J�J�F��F�#�#sV�*�
7�7�A�
A$�#A$�EO�/(K(�AO�(=L(�%O�'L(�(B#O�O�Oc���|jrT|j�Od|_||_|�A|jr<|j�|jj|jj��|_dSdSdSdSdS)Nr)r�r,r^r3�encoder�r�)r6r�s  r.rSzPopen._save_inputts����z�
H�d�k�1�%&��"�#����$���$�"&�+�"4�"4�T�Z�5H�59�Z�5F�#H�#H�D�K�K�K�	
H�
H�1�1�%�$�$�$r-c��|���|j�dS	tj|j|��dS#t
$rYdSwxYw)r�N)r�r2r�r�r1�ProcessLookupErrorr�s  r.r�zPopen.send_signal�s_��$
�I�I�K�K�K���*���

�����#�&�&�&�&�&��%�
�
�
����
���s�;�
A	�A	c�D�|�tj��dS)z/Terminate the process with SIGTERM
            N)r�r;r�r>s r.r�zPopen.terminate�� ��
���V�^�,�,�,�,�,r-c�D�|�tj��dS)z*Kill the process with SIGKILL
            N)r�r;�SIGKILLr>s r.r�z
Popen.kill�rlr-)r|NNNNNTFNNNNrTFr,rG)Fr1)<r)r*r+rIrvr7rkr�r�r�r�rJr�rKrkrmrsrwrxr�r�rmr}r�r�r�r�r�r�r�r��contextmanagerr�r�r>r�r�rDrlr��
WAIT_OBJECT_0r�rvrpr�r�r�r�r�rr=r>r?r$rCrDr'�ECHILDrIrSr,r-r.rr�s�������6�6�n�N�48�15�,0�EI�12�9>��
�'+�$�T��t�$�b�2�#������B���$��E�$6�7�7��
����X��
��2�2���2�>�>�>�������8 #�{�(�-�
!�
!�
!�
!����
���2A �A �A �A �H%�%�%�%�%�%�-2�	I�	I�	I�	I�����.+�+�+�:�������&�u
-�L	'�L	'�L	'�^	�	�	�
	5�
	5�
	5�}	$�}	$�}	$�~-1�%,�%@�&�4�$+�$>�	#�	#�	#�	#�"	#�	#�	#�$	�	�	�
0	$�0	$�0	$�d	G�	G�	G�
	%�
	%�
	%�����=	'�=	'�=	'�@%	4�%	4�%	4�Ng	4�g	4�g	4�V8O�+6�)2�
	?�
	?�
	?�
	?�-1�8�!�5�<� 	#� 	#� 	#� 	#�F
	�
	�
	�&	#�&	#�&	#�Rc	$�c	$�c	$�L		H�		H�		H�	�	�	�@	-�	-�	-�
	-�	-�	-�	-�	-r-r)\rIr&r'rAr�r�rLr;rwr)r�r�rr�r�r�r8�__all__r?r��ModuleNotFoundErrorrr&rlrrrrrrrrrrrrr r!r"r#r$r%r��_posixsubprocessr'rr#rC�waitstatus_to_exitcoder=�
WIFSTOPPEDr>�WSTOPSIGr?rKrDr\rW�	Exceptionrr
rr&rgrar�r_r
rorU�SelectSelectorrurqrrrr�r�r�rrr�objectrrr�r	r
rrr!rr,r-r.�<module>r{s��� � �D��������	�	�	�	�
�
�
�
�	�	�	�	�����
�
�
�
�
�
�
�
�������������#�#�#�#�#�#�������L�L�L�L�������E�E�E�����D�D�D����M�M�M��J�J�������J�J�J�������%;�;��
�'��N�N�N�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O��N�N�	N�	N�	N�	O�	O�	O�	O���<�<�<�<�<�<��:��"$�";���m���K�	��:����
���"&�����	����M�M�M�����'�&�&�&�&�i�&�&�&�"�"�"�"�"��"�"�"�J�����_����8�62�:�:�:�:�:�:�:�:�.����������,���
�C�0�0�I�
�w�y�.�)�)�2�"�/���"�1�����G�
�
�
�
��G����
��	��
�����:�:�:�z$�$�$�("������"
�
�
�&&*�2 �2 �2 �2 �2 �j!2�!2�!2�!2�!2�v�!2�!2�!2�J�5�$�e�CC�CC�CC�CC�CC�LC�C�C�R&*�$������@ $�D�
E�
E�
E�
E�
E�-�-�-�d$�#�%�%��
�
�{-�{-�{-�{-�{-�{-�{-�{-�{-�{-s!�?�A	�A	�A�A"�!A"

Zerion Mini Shell 1.0