%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.12/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.12/__pycache__/subprocess.cpython-312.pyc

�

���f�Z���dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlmZ
ddlZ	ddlZgd�Z	ddlZdZej*dvZer@ddlZddlmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)ejUgd	��nYerCdd
l+m,Z-ej\Z/ej`Z1ejdZ3ejhZ5ejlZ7ndZ-dZ/dZ1dZ3dZ5dZ7ddl8Z8ddl9Z9Gd�de:�Z;Gd
�de;�Z<Gd�de;�Z=erGd�d�Z>Gd�de?�Z@n,eAe8dd�ZBeCe9d�r
e9j�ZEne9j�ZEerdZGd�ZHngZGd�ZHdZIdZJdZKd�ZLd�ZMd�ZNdd �d!�ZOd"�ZPdd �d#�ZQGd$�d%eR�ZSddddd&�d'�ZTd(�ZUddd)�d*�ZVddd)�d+�ZWd,�ZXeX�ZYdZZGd-�d.�Z[y#e$rdZY���wxYw#e$rdZY���wxYw)/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��eZdZy)rN)�__name__�
__module__�__qualname__���!/usr/lib/python3.12/subprocess.pyrr{s�r-rc�R�eZdZdZdd�Zd�Zed��Zejd��Zy)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�<�||_||_||_||_y�N)�
returncode�cmd�output�stderr)�selfr2r3r4r5s     r.�__init__zCalledProcessError.__init__�s��$�����������r-c�&�|jr@|jdkr1d|j�dtj|j��d�Sd|j|jfzS#t$rd|j|jfzcYSwxYw)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�
4����&�.�.�$�/�/�1A�"B�D�D�D��H�H�d�o�o�G/�/�
/��	�
4�B����4�?�?�"2�F4�4�4�
4�s�0A(�(%B�Bc��|jS)z+Alias for output attribute, to match stderr�r4r>s r.�stdoutzCalledProcessError.stdout�s���{�{�r-c��||_yr1rA�r6�values  r.rBzCalledProcessError.stdout������r-�NN�	r)r*r+�__doc__r7r?�propertyrB�setterr,r-r.r
r
~s=����
/������]�]���r-r
c�R�eZdZdZdd�Zd�Zed��Zejd��Zy)rz�This exception is raised when the timeout expires while waiting for a
    child process.

    Attributes:
        cmd, output, stdout, stderr, timeout
    Nc�<�||_||_||_||_yr1)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��||_yr1rArDs  r.rBzTimeoutExpired.stdout�rFr-rGrHr,r-r.rr�s=����*������]�]���r-rc�(�eZdZddddddd�d�Zd�Zy)r&rN��dwFlags�	hStdInput�
hStdOutput�	hStdError�wShowWindow�lpAttributeListc�d�||_||_||_||_||_|xsdgi|_y)N�handle_listrS)r6rTrUrVrWrXrYs       r.r7zSTARTUPINFO.__init__�s8��"�D�L�&�D�N�(�D�O�&�D�N�*�D��#2�#I�}�b�6I�D� r-c���|jj�}d|vrt|d�|d<t|j|j
|j|j|j|��S)Nr[rS)	rY�copy�listr&rTrUrVrWrX)r6�	attr_lists  r.r]zSTARTUPINFO.copy�sf���,�,�1�1�3�I��	�)�+/�	�-�0H�+I�	�-�(��t�|�|�)-���*.�/�/�)-���+/�+;�+;�/8�:�
:r-)r)r*r+r7r]r,r-r.r&r&�s��&'�4�D�#��D�	J�
	:r-r&c�>�eZdZdZej
fd�Zd�Zd�ZeZ	y)�HandleFc�<�|jsd|_||�yy)NT)�closed)r6�CloseHandles  r.�ClosezHandle.Close�s���;�;�"����D�!�r-c�T�|jsd|_t|�Std��)NTzalready closed)rc�intr=r>s r.�Detachz
Handle.Detach�s&���;�;�"����4�y� ��-�.�.r-c�J�d|jjt|�fzS)Nz%s(%d))�	__class__r)rgr>s r.�__repr__zHandle.__repr__�s ���t�~�~�6�6��D�	�B�B�Br-N)
r)r*r+rc�_winapirdrerhrk�__del__r,r-r.rara�s'����$+�$7�$7�	"�
	/�	C��r-ra�PIPE_BUFi�PollSelectorc��yr1r,r,r-r.�_cleanuprqs��r-c��t�ytddD];}|jtj��}|��&	tj	|��=y#t
$rY�JwxYw)N��
_deadstate)�_active�_internal_poll�sys�maxsize�remover=)�inst�ress  r.rqrqs`���?���A�J�	�D��%�%����%�=�C�����N�N�4�(�		��
"����s�A�	A�A���������c�v�g}tjj}|dkDr|jdd|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�"s9���D��I�I���E��q�y����C�#��+�%�&��Kr-c��ddddddd�}t�}|j�D]<\}}ttj|�}|dkDs�&|jd	||zz��>tjjr|jd
�n�tjjr|jd�tjjr|jd�tjjr|jd
�tjdd}ttdi�}tjj}tjj}|dkDr|jd�n|r|jd�|r|jd�|D]}|jd|z��|r|jd�dD]-}||vs�||}	|	dur|}
n|�d|	��}
|jd|
f��/|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�,s���� #�����
�L�.�/�D�!�'�'�)�'�	��c��C�I�I�t�$���q�5��K�K��c�A�g�
�&�'�
�y�y������D���9�9�'�'��K�K����9�9�!�!��K�K����9�9����K�K������q�!�H��s�K��,�H��I�I�+�+�M��y�y�!�!�H��q�����-�.�	����/�0�����	�"�� �����D�3�J�� �����M�"�:�%���(�?��S�M�E���}���!$�e�,���K�K��s��$�%��Kr-c��tjjr�tj�}|jj
}d}|jx}r.|jj
|k7rn|dz
}|jx}r�.tjdt|�tjjrytj�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�y�&�&��M�M�O���8�8�'�'���
��8�8�m�a�m��x�x�#�#�x�/���!�O�J��8�8�m�a�m�	�
�
�:�%�z�	3��y�y�����!�!�#�#r-�rNc��t|i|��5}	|j|��cddd�S#|j��xYw#1swYyxYw)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}sS��
�	�	$�V�	$���	��6�6�'�6�*����	�
�F�F�H���
��s�?�)�<�?�Ac�f�t|i|��}|r$|jd�}|�|d}t||��y)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�r)r�getr
)r�r��retcoder3s    r.rr�sB���I�(��(�G���j�j�� ���;��A�,�C� ��#�.�.�r-c��dD]}||vs�t|�d���d|vrS|d�N|jd�s3|jd�s"|jd�s|jd�rd}nd	}||d<t|t|d
d�|��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.�input�universal_newlines�text�encoding�errors�r-T)rBrNr�)r=r�rrrB)rNr�r��kw�emptys     r.rr�s���F"�S��
��<���t�#P�Q�R�R�S��&��V�G�_�4��:�:�*�+�v�z�z�&�/A�V�Z�Z�PZ�E[��:�:�h�'��E��E���w���	�$��t������ r-c�H�eZdZdZdd�Zd�Zeej�Z	d�Z
y)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�<�||_||_||_||_yr1)r�r2rBr5)r6r�r2rBr5s     r.r7zCompletedProcess.__init__�s����	�$��������r-c��dj|j�dj|j�g}|j�*|j	dj|j��|j
�*|j	dj|j
��djt
|�jdj|��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�:��;�;�"��K�K�
�,�,�T�[�[�9�:����t�D�z�2�2�D�I�I�d�O�D�Dr-c��|jr6t|j|j|j|j��y)z6Raise CalledProcessError if the exit code is non-zero.N)r2r
r�rBr5r>s r.�check_returncodez!CompletedProcess.check_returncode�s4���?�?�$�T�_�_�d�i�i����%)�[�[�2�
2�r-rG)r)r*r+rIr7rk�classmethod�types�GenericAlias�__class_getitem__r�r,r-r.rr�s*��	��E�$�E�$6�$6�7��2r-r)r��capture_outputrNr�c��|�%|jd��td��t|d<|r?|jd��|jd��td��t|d<t|d<t|i|��5}	|j	||��\}}|j�}
|r|
rt|
|j||���ddd�tj
�S#t
$rJ}	|j
�tr|j	�\|	_|	_	�|j��d}	~	w|j
��xYw#1swY��xYw)	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�sU��<
���:�:�g��*��N�O�O���w����:�:�h��+�v�z�z�(�/C�/O��4�5�
5���x����x��	�	�	$�V�	$�C��	�$�0�0���0�H�N�F�F�&�,�,�.���W�$�W�g�l�l�,2�6�C�
C�/C�2�G�L�L�'�6�6�B�B��-�
	��L�L�N��*1�)<�)<�)>�&��
�C�J�

�������	��L�L�N���)C�C�s1�4E�6C�-E�	D=�"AD'�'D=�=E�E	c�B�g}d}ttj|�D]�}g}|r|jd�d|vxs	d|vxs|}|r|jd�|D]x}|dk(r|j|��|dk(r4|jdt	|�zdz�g}|jd��S|r|j|�g}|j|��z|r|j|�|s��|j|�|jd���dj
|�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��
�
�a� ��c���
�
�d�S��[�0��2�3����
�
�e�$���M�M�&�)��F��
�
�a� �	!�"��M�M�&�!���M�M�&�!��M�M�#��C!�F�7�7�6�?�r-�r�r�c��	t|ddt||��}d}|dddk(r|dd}||fS#t$r"}|j}|j}Yd}~�7d}~wwxYw)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	�sl��*!��C�t�$�v�%-�f�>�����B�C�y�D���C�R�y���T�>����!��y�y���=�=���!�s�*�	A�A�Ac�$�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�!�D�Dr-c��tsttd�sytjdvry	tj
d�}|j
d��}t|�dk7rt�|d	}ttt|dj
d
���}tjdk(r|dk(r|d
k\ryy#tttf$rYywxYw)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��
�|�|�+�+��
��j�j�.�/���	�	�1�	�%���u�:��?����Q�x����C��q�����!4�5�6���<�<�7�"�t�w��7�g�;M����
�J��0�
���
�s�BB6�6C
�C
c�:�eZdZdZdZ							d-dddddddddd�	d�Zd�Zeej�Z
ed��Zejd	��Zd
�Zd�Zd�Zej$ej(fd
�Zd�Zd�Zd.d�Zd�Zd�Z	d/d�Zd0d�Zd�Zej>d��Z e!rDd�Z"d�Z#d�Z$d�Z%de&jNe&jPe&jRfd�Z*d�Z+d�Z,d�Z-d�Z.d �Z/e/Z0yd!�Z"d"�Z1d#�Z%e2e3e4fd$�Z5de6e7e8jrfd%�Z*d&�Z:d'�Z+d(�Z-d)�Z;d*�Z.d+�Z/d,�Z0y)1rar 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|N)	�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
|�Ht!d��|r|st#j$dt&�d	}|
�t!d
��|dk7rt!d��||_d|_d|_d|_d|_d|_||_||_||_|�$|�"t;|�t;|�k7rt=d
��|xs
|xs|xs||_|j>r|�tA�x|_}d|_!d|_"|j>r|dk(rd	}d}nd}|�d}d}|��tGtHd�st!d��t|tJ�r!	ddl&}|jQ|�jR}n6t|t�r|}n#tdjUtW|����|dkrt!d|����d}|��tGtHd�st!d��t|tJ�rt!d��g}|D]�}t|tJ�r0	ddl&}|jY|jQ|�jR��Ct|t�r|jY|��etdjUtW|����|D]} | dks�	t!d| ����d}!|�}tGtHd�st!d��t|tJ�r!	ddl-}"|"j]|�j^}!nt|t�r|}!ntd��|!dkrt!d|!����|ja|||�\}#}$}%}&}'}(tr{|$dk7r$tcjd|$jg�d�}$|%dk7r$tcjd|%jg�d�}%|'dk7r$tcjd|'jg�d�}'	|$dk7rQtijj|$d|�|_|j>r)tijl|j*d	||� �|_|%dk7rOtijj|%d!|�|_|j>r'tijl|j,||�"�|_|'dk7rOtijj|'d!|�|_|j>r'tijl|j.||�"�|_|jo||||||
||
||	|#|$|%|&|'|(||||!|||�y#tN$rt!d��wxYw#tN$rt!d��wxYw#tN$rt!d��wxYw#tqd|j*|j,|j.f�D]"})	|)js��#t$rY� wxYw|jDs�g}*|ttk(r|*jY|#�|ttk(r|*jY|&�|ttk(r|*jY|(�tG|d#�r|*jY|jv�|*D]N}+	tr!t|+tx�r|+j{�ntIjr|+��A#t$rY�LwxYw�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������
�
�#�,�,��/K�L��
�	�
�'�^�^�-������&+��#��?��G��'�3�'��8�9�9����H��(�C�(��9�:�:���%� �"-�.�.��	��
�
�>��O� �	��&� �"-�.�.���!� �"-�.�.���	���
������������� ��
���� ��
�
��!3�!?��'�(�D��J�6�!�#F�G�
G�"�I�V�I�t�I�7I����>�>�h�.�'5�'7�7�D�M�H�
"&���&+��#��>�>��!�|�!%����!&��� ��M������2�z�*� �"4�5�5��E�3�'�J��
�l�l�5�)�0�0���E�3�'���� N�!'���U��!4�6�6��Q�w� �#D�S�E�!J�K�K����#��2�{�+� �"E�F�F��L�#�.� �!F�G�G��D�+�
@���k�3�/�7�"��K�K����[� 9� @� @�A���S�1��K�K��,�#�%9�%+�V�D��,=�%>�@�@�
@�&"�
V�	��q�=�$�'H���%T�U�U�
V������2�z�*� �"8�9�9��D�#�&�J���l�l�4�(�/�/���D�#�&���� E�F�F��Q�w� �#C�C�5�!I�J�J�&#�/�/��v�v�F�	��(�	�(�	�(���2�~�!�0�0����1B�A�F���"�}� �/�/����0@�!�D���"�}� �/�/����0@�!�D��6	��2�~��W�W�X�t�W�=��
��>�>�!#�!1�!1�$�*�*�D�+9�%-�f�">�D�J��"�}� �g�g�g�t�W�=����>�>�"$�"2�"2�4�;�;�%-�f�#>�D�K��"�}� �g�g�g�t�W�=����>�>�"$�"2�"2�4�;�;�%-�f�#>�D�K�
����j�*�i� (�#�s� +�]�E� '�� '�� '�� /� #�T�3�� 1�=�
B��o#�J�$�&I�J�J�J��8'�7�(�*6�7�7�7��8#�J�$�&I�J�J�J��P	��D�4�:�:�t�{�{�D�K�K�"H�I�
����G�G�I�������
��.�.����D�=��O�O�G�,��T�>��O�O�H�-��T�>��O�O�H�-��4��,��O�O�D�M�M�2�"��B��%�*�R��*@��H�H�J��H�H�R�L��"�����
�
�sz�"U/�V�V�	D%V7�/V�V�V4�72["�*W;�:["�;	X�["�X�B["�<[�["�	[�["�[�["c��d|jj�d|j�d|j�d�}t	|�dkDr|dddz}|S)N�<z: returncode: z args: �>�P�Lz...>)rjr)r2r�r�)r6�obj_reprs  r.rkzPopen.__repr__(s]������'�'�(�)��?�?�+�7�4�9�9�-�q�
B�	��x�=�2�����}�v�-�H��r-c��|jSr1)r3r>s r.r�zPopen.universal_newlines3s���~�~�r-c�$�t|�|_yr1)r2r3)r6r�s  r.r�zPopen.universal_newlines9s���0�1��r-c�j�|j||�}|jdd�jdd�S)Nz
r��
)�decode�replace)r6r�r�r�s    r.�_translate_newlineszPopen._translate_newlines=s0���{�{�8�V�,���|�|�F�D�)�1�1�$��=�=r-c��|Sr1r,r>s r.�	__enter__zPopen.__enter__As���r-c��|jr|jj�|jr|jj�	|jr|jj�|tk(r<|j
dkDr%	|j
|j
��d|_yd|_y|j�y#t$r
Yd|_ywxYw#|tk(rF|j
dkDr-	|j
|j
��n#t$rYnwxYwd|_Yy|j�wxYw)Nrr�)	rBrFr5r��KeyboardInterruptr4�_waitrr�)r6�exc_typerE�	tracebacks    r.�__exit__zPopen.__exit__Ds���;�;��K�K�����;�;��K�K����	��z�z��
�
� � �"��,�,��)�)�A�-���
�
�4�+A�+A�
�B�*+��&��*+��&��
�I�I�K��
*���)*��&�����,�,��)�)�A�-���
�
�4�+A�+A�
�B��)�����)*��&��
�I�I�K�sH�&C �
C
�
	C�C� E�:D�E�	D#� E�"D#�#E�0Ec���|jsy|j�|d|jzt|��|j	|��|j�t
�t
j
|�yyy)Nzsubprocess %s is still running)�sourcers)�_child_createdr2r1�ResourceWarningrvrur�)r6�_maxsize�_warns   r.rmz
Popen.__del__`si���"�"���?�?�"�
�2�T�X�X�=�!�$�
0�	
���x��0��?�?�"�w�':��N�N�4� �(;�"r-c��t|d�s7tjtjtj�|_|j
S)Nr%)r
r�rB�devnull�O_RDWRr%r>s r.�_get_devnullzPopen._get_devnullos0���t�Z�(��G�G�B�J�J��	�	�:�D�M��}�}�r-c�r�|r	|jj|�	|jj
�y#t$rY�'t$r)}|jtj
k(rn�Yd}~�Sd}~wwxYw#t$rYyt$r)}|jtj
k(rn�Yd}~yd}~wwxYwr1)r��write�BrokenPipeErrorrr'�EINVALrF)r6r�r�s   r.�_stdin_writezPopen._stdin_writets����
��
�
� � ��'�	��J�J�����#�
���
��9�9����,�����
���	���	��y�y�E�L�L�(�����	�s8�;�A:�	A7�A7�A2�2A7�:	B6�B6�
B1�1B6c���|jr
|rtd��|��|js�|j|j|jgjd�dk\r�d}d}|jr|j
|�n�|jr5|jj�}|jj�n@|jr4|jj�}|jj�|j�||fS|�t�|z}nd}	|j|||�\}}	d|_|j|j|���}||fS#t$r_|�&t|j|j|��}n|j}d|_	|j!|���#t"$rY�wxYwwxYw#d|_wxYw)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���$�&�&�5��M�N�N�

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

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

�� /3��+�s=�'E*�*AG�/G�G�	G�G�
G�G�G�	Gc�"�|j�S)zSCheck if child process has terminated. Set and return returncode
        attribute.)rvr>s r.r�z
Popen.poll�s���"�"�$�$r-c�"�|�y|t�z
S)z5Convenience for _communicate when computing timeouts.N)r�)r6r�s  r.r�zPopen._remaining_time�s���?���U�W�$�$r-c��|�y|s
t�|kDrDt|j||rdj|�nd|rdj|����d���y)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�sf���?���5�7�W�#4� ��I�I�|�3=�3�8�8�J�/�4�3=�3�8�8�J�/�I�
I�DH�I�
I�$5r-c��|�
t�|z}	|j|��S#t$r_|�&t|j|j��}n|j}d|_	|j|���#t$rY�wxYwwxYw)z=Wait for child process to terminate; returns self.returncode.r�r)r�rpror�r4r�r)r6rNr�r�s    r.r�z
Popen.wait�s������g��'�G�	��:�:�g�:�.�.�� �	�
�"�!$�T�%;�%;�%)�%9�%9�'�%B�"D��"&�!7�!7��%&�D�"�
��
�
�>�
�2�
��"�
���
��	�s.�#�AB�(A;�:B�;	B�B�B�Bc��t|dd�}tj�5}tra|dk7r|j	|j
�|dk7r|j	|j
�|dk7r�|j	|j
�n�|dk7r*|dk7r%||k7r |j	tj|�|dk7r*|dk7r%||k7r |j	tj|�|dk7r*|dk7r%||k7r |j	tj|�|� |j	tj|�ddd�d|_y#1swYd|_yxYw)Nr%r|T)	r��
contextlib�	ExitStackr��callbackrer�rFr5)	r6rWrXrYrZr[r\�
devnull_fd�stacks	         r.�_close_pipe_fdszPopen._close_pipe_fdss��
�T�:�t�4�
�
�
!�
!�
#�	5�u���b�=��N�N�7�=�=�1��r�>��N�N�8�>�>�2��r�>��N�N�8�>�>�2��b�=�X��^��:�8M��N�N�2�8�8�W�5��r�>�g��m��J�8N��N�N�2�8�8�X�6��r�>�g��m��J�8N��N�N�2�8�8�X�6��%����r�x�x��4�#	5�('+��#�)	5�('+��#�s�DE	�	Ec#�K�g}	|��y#t|d�r|j|j�|`|D]N}	tr!t	|t
�r|j
�ntj|��A#t$rY�LwxYw�xYw�w)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��	��t�Z�(�����
�
�.��M��
���!�j��V�&<����
������������

�
�s<�B
��B
�0B
�<A9�8B
�9	B�B
�B�B
�
B
c�D�|�|�|�yd\}}d\}}d\}}	|j�5}
|�qtjtj�}|��
tjdd�\}}t|�}|
j
|�tj|�n�|tk(rCtjdd�\}}t|�t|�}}|
j||f�nv|tk(r$tj|j��}nIt|t�rtj|�}n#tj|j!��}|j#|�}|�qtjtj$�}|��
tjdd�\}}t|�}|
j
|�tj|�n�|tk(rCtjdd�\}}t|�t|�}}|
j||f�nv|tk(r$tj|j��}nIt|t�rtj|�}n#tj|j!��}|j#|�}|�qtjtj&�}	|	��tjdd�\}}	t|	�}	|
j
|	�tj|�n�|tk(rCtjdd�\}}	t|�t|	�}	}|
j||	f�n�|t(k(r|}	nv|tk(r$tj|j��}	nIt|t�rtj|�}	n#tj|j!��}	|j#|	�}	ddd�||||||	fS#1swY�xYw)�|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_handles7s����}���F�N�/� &��G�X� &��G�X� &��G�X��)�)�+�=
<�}��=�%�2�2�7�3K�3K�L�G���%,�%7�%7��a�%@�
���"(��/��%�,�,�W�5��+�+�A�.��d�]�(/�(:�(:�4��(C�%�G�X�(.�w����9I�X�G�!�(�(�'�8�)<�=��g�%�$�2�2�4�3D�3D�3F�G�G���s�+�$�2�2�5�9�G�%�2�2�5�<�<�>�B�G��0�0��9���>�&�3�3�G�4M�4M�N�H��'�&-�&8�&8��q�&A���8�#)�(�#3��%�,�,�X�6��+�+�A�.��t�^�(/�(:�(:�4��(C�%�G�X�(.�w����9I�X�G�!�(�(�'�8�)<�=��w�&�%�3�3�D�4E�4E�4G�H�H����,�%�3�3�F�;�H� &�3�3�F�M�M�O�D�H��1�1�(�;���>�&�3�3�G�4L�4L�M�H��'�&-�&8�&8��q�&A���8�#)�(�#3��%�,�,�X�6��+�+�A�.��t�^�(/�(:�(:�4��(C�%�G�X�(.�w����9I�X�G�!�(�(�'�8�)<�=��v�%�'�H��w�&�%�3�3�D�4E�4E�4G�H�H����,�%�3�3�F�;�H� &�3�3�F�M�M�O�D�H��1�1�(�;��{=
<�~�X��X��X�'�
'�=
<�=
<�s�OP�Pc��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�sE���'�'��)�)�+�V��)�)�+�Q���-�-�/�A��!�9�r-c��t|D�chc]2}|dzdk7s&tj|�tjk7r|��4c}�Scc}w)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.�)r^rl�GetFileType�FILE_TYPE_CHAR)r6r[r�s   r.�_filter_handle_listzPopen._filter_handle_list�sR���k�4�F�"�S�L�C�/�#�/�/��7�#�2�2�3� �4�5�
5��4s�7Ac���|rJd��t|t�rnit|t�r|
rtd��t	|g�}n?t|t
j�r|
rtd��t	|g�}nt	|�}|�tj|�}|�t�}n|j�}d|||fv}|r8|xjtjzc_
||_
||_||_|j }t#|xrd|vxr|d�}|s|r�|r�|�	ix}|_t%|j'dg��x}|d<|r#|t)|�t)|�t)|�gz
}|j+|�|dd|r|st-j.dt0�d}|
r�|xjtj2zc_
tj4|_|s�t
j8j'd	�}|skt
j8j'd
d�}t
j:j=|dd
�}t
j:j?|�stAd��t
j:j?|�r|}n|}djC||�}|�tj|�}tEjFd||||�	tjH||ddt)|�|	|||�	\}}} }!|jK|||
|||�d|_&tO|�|_(| |_)tjT|�y#|jK|||
|||�wxYw)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�<��$��$���D�%�(��#�$J�K�K�#�T�F�+���D�"�+�+�.��#�%4�5�5�#�T�F�+��#�D�)���%��[�[��4�
��"�)�m��*�.�.�0�� ��(�H�(E�E�O���#�#�w�'C�'C�C�#�(/��%�)1��&�(0��%�(�8�8�N�#�N�%B�$1�^�$C�%B�$2�=�$A� C��
 �O�	�!�)�CE�E�N�[�%@���+�+�M�2�>�?�@��n�]�;�#��C��L�#�h�-��X��#O�O�K�!%�!9�!9�+�!F��A���$� �
�
�'=�>L�N�!&�I���#�#�w�'C�'C�C�#�*1�/�/��'�!�!�j�j�n�n�Y�7�G�"�&(�j�j�n�n�\�2�&F��"$�'�'�,�,�{�J�	�"R��!�w�w�}�}�W�5�"3�4p�"q�q��w�w�}�}�W�-�%,�
�(�G�#�*�*�G�T�:�����k�k�#�&���I�I�(�*�d�C��E�
8�#*�#8�#8��T�)-�t�),��]�);�)6�),�),�)4�$6� ��B��S��$�$�W�h�%,�h�%,�h�8�
#'�D��!�"�:�D�L��D�H�����#���$�$�W�h�%,�h�%,�h�8�s�,M�M$c��|j�-||jd�|k(r||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.

            r)r2r�)r6rt�_WaitForSingleObject�_WAIT_OBJECT_0�_GetExitCodeProcesss     r.rvzPopen._internal_polls;�����&�'����a�8�N�J�&9�$�,�,�&G�D�O��?�?�"r-c�^�|�tj}n|dkrd}nt|dz�}|j�mtj|j
|�}|tjk(rt|j|��tj|j
�|_|jS)z-Internal implementation of wait() on Windows.ri�)
rl�INFINITErgr2�WaitForSingleObjectr��WAIT_TIMEOUTrr��GetExitCodeProcess)r6rN�timeout_millisr�s    r.rpzPopen._wait,s�����!(�!1�!1���A��!"��!$�W�t�^�!4�����&� �4�4�T�\�\�5C�E���W�1�1�1�(����G�<�<�")�"<�"<�T�\�\�"J����?�?�"r-c�b�|j|j��|j�yr1)r�r�rF)r6�fh�buffers   r.�
_readerthreadzPopen._readerthread>s���M�M�"�'�'�)�$��H�H�Jr-c���|jrzt|d�sng|_tj|j
|j|jf��|_d|j_|jj�|jrzt|d�sng|_
tj|j
|j|jf��|_d|j_|jj�|jr|j|�|j�Z|jj|j|��|jj!�rt#|j$|��|j�Z|jj|j|��|jj!�rt#|j$|��d}d}|jr&|j}|jj'�|jr&|j}|jj'�|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._communicateCs���{�{�7�4��#@�$&��!�!�(�(��0B�0B�/3�{�{�D�<M�<M�.N�P��"�-1��"�"�)��"�"�(�(�*��{�{�7�4��#@�$&��!�!�(�(��0B�0B�/3�{�{�D�<M�<M�.N�P��"�-1��"�"�)��"�"�(�(�*��z�z��!�!�%�(�
�{�{�&��"�"�'�'��(<�(<�W�(E�F��%�%�.�.�0�(����L�A�A��{�{�&��"�"�'�'��(<�(<�W�(E�F��%�%�.�.�0�(����L�A�A��F��F��{�{��*�*�����!�!�#��{�{��*�*�����!�!�#�#)�V�A�Y�d�F�"(�V�A�Y�d�F��F�#�#r-c��|j�y|tjk(r|j�y|tjk(r/tj|jtj�y|tjk(r/tj|jtj�ytdj|���)�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�n�$���� ���+�+�+�������&�"5�"5�6���/�/�/�������&�"9�"9�:� �!9�!@�!@��!E�F�Fr-c���|j�y	tj|jd�y#t$r=tj
|j�}|tjk(r�||_YywxYw)zTerminates the process.Nr�)r2rl�TerminateProcessr��PermissionErrorr��STILL_ACTIVE)r6�rcs  r.r�zPopen.terminate�sg�����*��
%��(�(����q�9��"�
%��/�/����=����-�-�-��"$���

%�s� 0�AA6�5A6c�f�d\}}d\}}d\}}	|j�5}
|�n�|tk(rytj�\}}|
j	||f�|j
dkDr}t
td�rmtj|tj|j
�n=|tk(r|j�}n#t|t�r|}n|j�}|�n�|tk(rytj�\}}|
j	||f�|j
dkDr}t
td�rmtj|tj|j
�n=|tk(r|j�}n#t|t�r|}n|j�}|�n�|tk(rytj�\}}	|
j	||	f�|j
dkDr�t
td�r�tj|	tj|j
�nm|tk(r'|dk7r|}	n\tj j�}	n=|tk(r|j�}	n#t|t�r|}	n|j�}	ddd�||||||	fS#1swY�xYw)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�sB��!'��G�X� &��G�X� &��G�X��)�)�+�1
/�}��=���d�]�(*���	�%�G�X�!�(�(�'�8�)<�=��}�}�q�(�W�U�N�-K����H�e�.@�.@�$�-�-�P��g�%�"�/�/�1�G���s�+�#�G�$�l�l�n�G��>���t�^�(*���	�%�G�X�!�(�(�'�8�)<�=��}�}�q�(�W�U�N�-K����H�e�.@�.@�$�-�-�P��w�&�#�0�0�2�H����,�%�H� &�}�}��H��>���t�^�(*���	�%�G�X�!�(�(�'�8�)<�=��}�}�q�(�W�U�N�-K����H�e�.@�.@�$�-�-�P��v�%��2�~�#+��#&�>�>�#8�#8�#:���w�&�#�0�0�2�H����,�%�H� &�}�}��H�c1
/�f�X��X��X�'�
'�g1
/�1
/�s�I7J'�'J0c���|�tj}i}|r3g}dD]'}
tt|
d�}|��|j	|��)||d<g}|||	fD])}|dk7s�	|j	tj
|f��+|df|df|
dffD]-\}}|dk7s�|j	tj||f��/|r||d<tj|||fi|��|_d	|_	|j|||||	|
�y)
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�s5��
�{��j�j���F����?�.�G�$�V�W�d�;�F��)��
�
�f�-�.�'-��{�#��L���'�2�
D����8� �'�'��)=�)=�r�(B�C�
D��!���1�
��1�
��
H���C�
��8� �'�'��)<�)<�b�#�(F�G�

H��)5��~�&��~�~�j�$��F�v�F�D�H�"&�D��� � ��(�!(�(�!(�(�
4r-c�\	��t|ttf�r|g}n6t|tj�r|
rtd��|g}nt
|�}|
r"ttd�rdnd}|dg|z}�r�|d<��|d�tjd�|||�trrtjj��rS|�Q|sO|sM|�K|d	k(s|d
kDrA|d	k(s|d
kDr7|d	k(s|d
kDr-|s+|d	k(r&|�$|�"|� |dkr|j|�|||||
|||�
y�}tj�\}}g}|dkr,|j|�tj |�}|dkr�,|D]}tj"|��		|�ig}|j%�D]S\}} tj&|�}d|vrt)d
��|j|dztj&| �z��Und}tj&���tjj��r�f}!n't+�fd�tj,|�D��}!t/|�}"|"j1|�t3||!|t+t5t7t8|"���|||||
|||||||||||||t:�|_d|_tj"|�|jA|||
|||�tC�}#	tjD|d�}$|#|$z
}#|$rtG|#�dkDrn�-	tj"|�|#�r	tjH|j<d�\}%}&|%|j<k(r|jK|&�ntjL|_'	|#jSdd
�\}'}(})|)jU�})tYtZ|'jUd�t\�}*t_|*t`�rS|(rQt9|(d�}+|)dk(rd})|},n|)dk(rd})d},n|},|+dk7rtjb|+�})|,�
|*|+|)|,��|*|+|)��|*|)��y#tj"|�wxYw#tj"|�wxYw#tP$rY��wxYw#t($r!d}'d}(djWt|#��})Y��wxYw)zExecute program (POSIX version)r��getandroidapilevelz/system/bin/shz/bin/shz-crNr�r|r�r��=z!illegal environment variable namec3��K�|]7}tjjtj|������9y�wr1)r�r�r��fsencode)�.0�dirrHs  �r.�	<genexpr>z'Popen._execute_child.<locals>.<genexpr>Xs1�����0>� #��G�G�L�L����S�)9�:�F�0>�s�=ATiP��: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�s�����$��e��-��v���D�"�+�+�.��#�%4�5�5��v���D�z���"�#�';�<�/�BK��"�D�)�D�0���(�D��G��!�!�!�W�
��I�I�(�*�d�C��E� ������
�3�"�*�%�$��� �B��'�A�+�!�R��8�a�<�!�R��8�a�<�-�%��+���������	��!�!�$�
�C��")�8�")�8�")�8�5��(�O�
+-�'�'�)�'�L�-�!���!�#� �'�'�
�6� "���}� 5�
� �!�#�+�
!������ �
!�7
'�&,���#%��$'�I�I�K�G�D�A�q� "���A��A�#�q�y�&0�1T�&U� U�$�O�O�A��H�r�{�{�1�~�,E�F�	G�$(��!#���Z�!8�J��w�w���z�2�+5�-��+0�0>�')�'7�'7��'<�0>�+>��#&�h�-�K��O�O�M�2�)� �/�%�u�V�C��[�4I�-J�'K���#�X�w��#�X�(�-�+�->�)�3��c�5�&�
�	 4�D�H�+/�D�'��H�H�]�+��$�$�W�h�%,�h�%,�h�8� )�{����7�7�<��7�D� �D�(�L��3�|�#4�u�#<��	������&���!�z�z�$�(�(�A�6�H�C���d�h�h���/�/��4�*-�+�+���7�(�.�.�t�Q�7�7�N�I�w�
&�n�n�.�G�(/� �.�"7�"7��"@�'�()�$��2�G�<�� #�I�r� 2�I��.�0�"$��'*�� �H�,�"$��'+��'6�� �A�~�"$�+�+�i�"8��#�/�2�9�g�|�T�T�2�9�g�F�F�*�7�3�3�U��%�H�H�]�+�� ����&��)�����"�7�%7�N� $�I�C�J�J�"'��"5�7�G�7�sE�8D9P>�1A#Q�.AQ2�&R�>Q�Q�Q/�2	Q>�=Q>�'R+�*R+c�L�||�r||�|_y||�|_y)�:All callers to this function MUST hold self._waitpid_lock.N)r2)r6r��_waitstatus_to_exitcode�_WIFSTOPPED�	_WSTOPSIGs     r.r"zPopen._handle_exitstatus�s%���3��#,�S�>�/���"9�#�">��r-c�2�|j��|jjd�sy	|j�&|j|jj�S||j|�\}}||jk(r|j|�|jj�|jS|jS#t$r*}|�||_n|j|k(rd|_Yd}~�`d}~wwxYw#|jj�wxYw)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� �1����2�#����&�&�.�.�0� (����(�;�H�C���d�h�h���/�/��4��&�&�.�.�0��?�?�"�4�?�?�"���	,�!�-�*4������G�+�+,�����	,���&�&�.�.�0�s/�C�6C�	C7�
 C2�-C:�2C7�7C:�:Dc��	tj|j|�\}}||fS#t$r|j}d}Y||fSwxYw)r:r)r�r!r1r#)r6�
wait_flagsr1r�s    r.�	_try_waitzPopen._try_wait�sV��
��Z�Z����*�=�
��c���:���
%�
��h�h������:��

�s�#)�A�Ac�D�|j�|jS|��Lt�|z}d}	|jjd�r�	|j�'	|jj	�|jS|jtj�\}}||jk(s|dk(sJ�||jk(r8|j|�	|jj	�|jS	|jj	�|j|�}|dkrt|j|��t|dz|d�}tj|���<|j�w|j5|j�	ddd�|jS|jd�\}}||jk(r|j|�ddd�|j��w|jS#|jj	�wxYw#1swY�AxYw)z+Internal implementation of wait() on POSIX.Ng����Mb@?Frr�g�������?)r2r�r+r?r@rGr��WNOHANGr1r"r�rr�r��time�sleep)r6rNr��delayr1r��	remainings       r.rpzPopen._wait�s������*����&��"��'�G�+������)�)�1�1�%�8�	9�#���:� %�!�.�.�6�6�8�"�?�?�"�/*.����
�
�)C�J�S�#�#&�$�(�(�?�c�Q�h�>�#>�"�d�h�h�� $� 7� 7�� <� %� �.�.�6�6�8�"�?�?�"�+ /�!�.�.�6�6�8� $� 4� 4�W� =�I� �A�~�,�T�Y�Y��@�@����	�9�c�:�E��J�J�u�%�!�$�o�o�-��+�+�9��?�?�6�!�9��?�?�"�
&*�^�^�A�%6�
��c��$�(�(�?� �3�3�C�8�9��o�o�-��?�?�"��#!�.�.�6�6�8��9�9�s%�G7�;AG7�H�"4H�7H�Hc�
�|jrD|js8	|jj�|s	|jj	�d}d}|jsQi|_|jrg|j
|j<|jrg|j
|j<|jr|j
|j}|jr|j
|j}|j|�|jrt|j�}t�5}|jr,|r*|j|jtj�|jr@|jjs*|j|jtj �|jr@|jjs*|j|jtj �|j#��r�|j%|�}|�&|dkr!|j'||||d��t)d��|j+|�}	|j'||||�|	D�]o\}
}|
j,|jur�|j.|j.t0z}	|xj.t3j4|
j6|�z
c_|j.t9|j�k\s��|j;|
j,�|
j,j	���|
j,|j|jfvs��t3j<|
j6d�}
|
s5|j;|
j,�|
j,j	�|j
|
j,j?|
���r|j#�r���ddd�|jA|j%|���|�djC|�}|�djC|�}|jDrz|�;|jG||jjH|jjJ�}|�;|jG||jjH|jjJ�}||fS#t$rY���wxYw#t$rY���wxYw#t$r9|j;|
j,�|
j,j	�Y���wxYw#1swY��@xYw)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._communicatesP���z�z�$�"=�"=���J�J�$�$�&����
�
�(�(�*��F��F��.�.�')��$��;�;�8:�D�(�(����5��;�;�8:�D�(�(����5��{�{��-�-�d�k�k�:���{�{��-�-�d�k�k�:�����U�#��{�{�'����4�
��!�*
K�X��:�:�%��%�%�d�j�j�)�2G�2G�H��;�;�t�{�{�'9�'9��%�%�d�k�k�9�3G�3G�H��;�;�t�{�{�'9�'9��%�%�d�k�k�9�3G�3G�H��&�&�(�"�2�2�7�;�G��*�w��{��+�+�G�\�,2�F�AE�,�G�+�>�?�?�%�O�O�G�4�E��'�'���v�v�N�
(-�K���V��;�;�$�*�*�4�$.�t�/A�/A�/3�/A�/A�I�/M�%O�E�8� $� 2� 2�b�h�h�s�v�v�u�6M� M� 2�
$(�#5�#5��T�[�[�9I�#I�$,�$7�$7����$D�$'�K�K�$5�$5�$7� �[�[�T�[�[�$�+�+�,F�F�#%�7�7�3�6�6�5�#9�D�#'� (� 3� 3�C�K�K� @� #��� 1� 1� 3� �0�0����=�D�D�T�J�%K�!�&�&�(�*
K�X
�I�I�d�2�2�7�;�I�<��!����&�)���!����&�)���~�~��%�!�5�5�f�6:�k�k�6J�6J�6:�k�k�6H�6H�J�F��%�!�5�5�f�6:�k�k�6J�6J�6:�k�k�6H�6H�J�F��F�#�#��{'�����
+�����l$3�4� (� 3� 3�C�K�K� @� #��� 1� 1� 3�4��=*
K�*
K�sa�S�S(�8FT=�:3S8�-"T=�AT=�+BT=�	S%�$S%�(	S5�4S5�8>T:�6T=�9T:�:T=�=Uc��|jru|j�hd|_||_|�W|jrJ|jj	|jj
|jj�|_yyyyy)Nr)r�r,r\r3�encoder�r�)r6r�s  r.rQzPopen._save_inputtsn���z�z�d�k�k�1�%&��"�#����$����"&�+�+�"4�"4�T�Z�Z�5H�5H�59�Z�Z�5F�5F�#H�D�K�*8�$�2�zr-c��|j�|j�y	tj|j|�y#t
$rYywxYw)r�N)r�r2r�r�r1�ProcessLookupErrorr�s  r.r�zPopen.send_signal�sC��$
�I�I�K����*��

�������#�&��%�
��
�s� A�	A�Ac�B�|jtj�y)z/Terminate the process with SIGTERM
            N)r�r;r�r>s r.r�zPopen.terminate����
���V�^�^�,r-c�B�|jtj�y)z*Kill the process with SIGKILL
            N)r�r;�SIGKILLr>s r.r�z
Popen.kill�rjr-)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"rArBr'�ECHILDrGrQr,r-r.rr�s���6�n�N�48�15�,0�EI�12�9>��
�'+�$�T��t�$�b�2�#��B�$�E�$6�$6�7��
����
���2��2�>���8 #�{�{�(�-�-�
!��
�2A �H%�%�-2�	I��.+�:������&�L	'�^	�
	5�}	$�~-1�%,�%@�%@�&�4�4�$+�$>�$>�	#�"	#�$	�
0	$�d	G�
	%���=	'�@%	4�Ng	4�V8O�+6�)2�
	?�-1�8�!�5�<�<� 	#�F
	�&	#�Rc	$�L		H�	�@	-�
	-r-r)\rIr$r'rAr�r�rJr;rwr)r�r�rr�r�r�r8�__all__r?r��ModuleNotFoundErrorrr&rlrrrrrrrrrrrrr r!r"r#r$r%r��_posixsubprocessr'rr!rA�waitstatus_to_exitcoder;�
WIFSTOPPEDr<�WSTOPSIGr=rIrBrZrU�	Exceptionrr
rr&rgrar�r]r
rorS�SelectSelectorrurqrrrr�r�r�rrr�objectrrr�r	r
rrrrr,r-r.�<module>rysQ�� �D��	�
�	��
�
����#����
D�����J����%;�;��
��O�O�O�O�O��N�N�	N�	O��<��:�:��"$�";�";���m�m���K�K�	��:�:���
���"&�����	�����'�i�&�"��"�J�_��8�:�:�.���,��
�C�0�I�
�y�.�)�"�/�/��"�1�1����G�
��G��
��	��
���:�z$�("��"
�&&*�2 �j!2�v�!2�J�5�$�e�CC�LC�R&*�$��@ $�D�
E�-�d$�%��
�
�{-�{-��e���E������J��s#�F>�G�>G	�G	�G�G

Zerion Mini Shell 1.0