Your IP : 3.17.135.107
�
!��g}\���dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddlm
ZddlZ ddl
Z
gd�Z ddlZdZej&dvZer@ddlZddlmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'ejQgd ��nYerCdd
l)m*Z+ejXZ-ej\Z/ej`Z1ejdZ3ejhZ5ndZ+dZ-dZ/dZ1dZ3dZ5ddl6Z6ddl7Z7Gd�de8�Z9Gd
�de9�Z:Gd�de9�Z;erGd�d�Z<Gd�de=�Z>n,e?e6dd�Z@eAe7d�r
e7j�ZCne7j�ZCerdZEd�ZFngZEd�ZFdZGdZHdZId�ZJd�ZKd�ZLdd �d!�ZMd"�ZNdd �d#�ZOGd$�d%eP�ZQddddd&�d'�ZRd(�ZSddd)�d*�ZTddd)�d+�ZUd,�ZVeV�ZWdZXGd-�d.�ZYy#e$rdZ
Y���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__���1/opt/alt/python312/lib64/python3.12/subprocess.pyrrys�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@|jdkr1ddl}d|j�d|j|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.)r2�signalr3�Signals�
ValueError�r6r;s 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�,A(�(%B�Bc��|jS)z+Alias for output attribute, to match stderr�r4�r6s r.�stdoutzCalledProcessError.stdout�s���{�{�r-c��||_yr1rA�r6�values r.rCzCalledProcessError.stdout������r-�NN� r)r*r+�__doc__r7r?�propertyrC�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)r6r3rOr4r5s r.r7zTimeoutExpired.__init__�s�������������r-c�<�d|j�d|j�d�S)Nr9z' timed out after z seconds)r3rOrBs r.r?zTimeoutExpired.__str__�s�����4�<�<�)� *r-c��|jSr1rArBs r.rCzTimeoutExpired.stdout�s���{�{�r-c��||_yr1rArEs r.rCzTimeoutExpired.stdout�rGr-rHrIr,r-r.rr�s=����*������]�]���r-rc�(�eZdZddddddd�d�Zd�Zy)r&rN��dwFlags� hStdInput�
hStdOutput� hStdError�wShowWindow�lpAttributeListc�d�||_||_||_||_||_|xsdgi|_y)N�handle_listrT)r6rUrVrWrXrYrZs 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\rT) rZ�copy�listr&rUrVrWrXrY)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.�ClosezHandle.Close�s���;�;�"����D�!�r-c�T�|jsd|_t|�Std��)NTzalready closed)rd�intr=rBs r.�Detachz
Handle.Detach�s&���;�;�"����4�y� ��-�.�.r-c�J�d|jjt|�fzS)Nz%s(%d))� __class__r)rhrBs r.�__repr__zHandle.__repr__�s ���t�~�~�6�6��D� �B�B�Br-N)
r)r*r+rd�_winapirerfrirl�__del__r,r-r.rbrb�s'����$+�$7�$7� "�
/� C��r-rb�PIPE_BUFi�PollSelectorc��yr1r,r,r-r.�_cleanuprrs��r-c��t�ytddD];}|jtj��}|��& tj |��=y#t
$rY�JwxYw)N��
_deadstate)�_active�_internal_poll�sys�maxsize�remover=)�inst�ress r.rrrrs[���?���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)rx�flags�optimize�append)�argsrFs r.�"_optim_args_from_interpreter_flagsr�"s9���D��I�I���E��q�y����C�#��+�%�&��Kr-c��ddddddd�}t�}|j�D]<\}}ttj|�}|dkDs�&|jd ||zz��>tjjr|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�getattrrxr�r��isolated�ignore_environment�no_user_site� safe_path�warnoptionsr��dev_moderz�extend)�flag_opt_mapr��flag�optr��warnopts�xoptionsr�r�rF�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}|jx}r.|jj
|k7rn|dz
}|jx}r�.tjdt|�tjjryddl}|j�S)N�r�z"'encoding' argument not specified.zutf-8r)
rxr��warn_default_encoding� _getframe�f_code�co_filename�f_back�warnings�warn�EncodingWarning� utf8_mode�locale�getencoding)�f�filename�
stacklevelr�s 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-�rOc��t|i|��5} |j|��cddd�S#|j��xYw#1swYyxYw)z�Run command with arguments. Wait for command to complete or
for timeout seconds, 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)rO� popenargs�kwargs�ps r.rrsJ��
� � $�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.
)rC�checkz- argument not allowed, it will be overridden.�input�universal_newlines�text�encoding�errors�r-T)rCrOr�)r=r�rrrC)rOr�r��kw�emptys r.rr�s���F"��
��<���t�#P�Q�R�R�"��&��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�r2rCr5)r6r�r2rCr5s 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�r2rCr�r5�typer)�join)r6r�s r.rlzCompletedProcess.__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�rCr5rBs r.�check_returncodez!CompletedProcess.check_returncode�s4���?�?�$�T�_�_�d�i�i����%)�[�[�2�
2�r-rH)r)r*r+rJr7rl�classmethod�types�GenericAlias�__class_getitem__r�r,r-r.rr�s*�� ��E�$�E�$6�$6�7��2r-r)r��capture_outputrOr�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 (seconds) 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.rCr5z@stdout and stderr arguments may not be used with capture_output.r��r4r5)r�r=rr�communicaterr��
_mswindowsrCr5r��pollr
r�r)r�r�rOr�r�r��processrCr5�excr�s r.rr�sJ��<
���:�:�g��*��N�O�O���w����:�:�h��+�v�z�z�(�/C�/O��4�5�
5���x����x�� � � $�V� $�� �$�0�0���0�H�N�F�F�&�,�,�.���W�$�W�g�l�l�,2�6�C�
C�/
%�2�G�L�L�'�6�6�B�B��-�
��L�L�N��*1�)<�)<�)>�&��
�C�J�
������� ��L�L�N���)
%� $�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�Bs��<�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|dk(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�rx�platform�confstr�splitr�r=�tupler�rh�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��Zejd ��Zd
�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$rt!d��wxYw#tN$rt!d��wxYw#tN$rt!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�ENOTSUPrxrrr� threading�Lock�
_waitpid_lock�_input�_communication_started�
isinstancerh� TypeErrorr�r=r�r��RuntimeWarningr�r�rCr5�pidr2r�r�r�boolr� text_moder��_sigint_wait_secs�_closed_child_pipe_fdsrr��str�grp�ImportError�getgrnam�gr_gidr�r�r��pwd�getpwnam�pw_uid�_get_handles�msvcrt�open_osfhandleri�io�open�
TextIOWrapper�_execute_child�filter�closerr&rbrf),r6r��bufsize�
executabler�rCr5�
preexec_fn� close_fdsr��cwd�envr��startupinfo�
creationflags�restore_signals�start_new_session�pass_fdsrrrr�r�r�rrrr$�gidr8�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��,=�%>�@�@� ,�&"� ��q�=�$�'H���%T�U�U�"������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�������J��.�.����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...>)rkr)r2r�r�)r6�obj_reprs r.rlzPopen.__repr__*s]������'�'�(�)��?�?�+�7�4�9�9�-�q�
B� ��x�=�2�����}�v�-�H��r-c��|jSr1)r4rBs r.r�zPopen.universal_newlines5s���~�~�r-c�$�t|�|_yr1)r3r4)r6r�s r.r�zPopen.universal_newlines;s���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,rBs r.� __enter__zPopen.__enter__Cs���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�) rCrGr5r��KeyboardInterruptr5�_waitrr�)r6�exc_typerF� tracebacks r.�__exit__zPopen.__exit__Fs���;�;��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)�sourcert)�_child_createdr2r2�ResourceWarningrwrvr�)r6�_maxsize�_warns r.rnz
Popen.__del__bsi���"�"���?�?�"�
�2�T�X�X�=�!�$�
0�
���x��0��?�?�"�w�':��N�N�4� �(;�"r-c��t|d�s7tjtjtj�|_|j
S)Nr&)rr�rC�devnull�O_RDWRr&rBs r.�_get_devnullzPopen._get_devnullqs0���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(�EINVALrG)r6r�r�s r.�_stdin_writezPopen._stdin_writevs����
��
�
� � ��'� ��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�rCr5�countr��readrGr��_time�_communicaterp�minr5�_remaining_timerqr)r6r�rOrCr5�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.)rwrBs 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�rqrpr�r5r�r)r6rOr�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 tj|�|dk7r*|dk7r%||k7r |j tj|�|dk7r*|dk7r%||k7r |j tj|�|� |j tj|�ddd�d|_y#1swYd|_yxYw)Nr&r}T) r��
contextlib� ExitStackr��callbackrfr�rGr6) r6rXrYrZr[r\r]�
devnull_fd�stacks r.�_close_pipe_fdszPopen._close_pipe_fdss��
�T�:�t�4�
�
�
!�
!�
#�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�#$�('+��#�)$�('+��#�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)
rr�r&r�r/rbrfr�rGr)r6r^r_s r.�_on_error_fd_closerzPopen._on_error_fd_closer!s������� ��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�rm�GetStdHandler�
CreatePiperbr�rerr�rr@�
get_osfhandler~r/rh�fileno�_make_inheritablerrr)r6r�rCr5rXrYrZr[r\r]�
err_close_fds�_s r.r?zPopen._get_handles9s����}���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�)rm�DuplicateHandle�GetCurrentProcess�DUPLICATE_SAME_ACCESSrb)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_rm�GetFileType�FILE_TYPE_CHAR)r6r\r�s r.�_filter_handle_listzPopen._filter_handle_list�sV���k�4�k�F�"�S�L�C�/�#�/�/��7�#�2�2�3� �k�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=|dd
�}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/r7�bytesr0r�r��PathLiker�r&r^rUrmrrVrWrXrZr3r_r�rhr�r�r�r1rrrY�environ�pathr��isabs�FileNotFoundErrorr�rx�audit�
CreateProcessr�rwrb�_handler2re)"r6r�rIrJrKrRrLrMrNrOr�rXrYrZr[r\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�htr2�tids" r.rEzPopen._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�)r6ru�_WaitForSingleObject�_WAIT_OBJECT_0�_GetExitCodeProcesss r.rwzPopen._internal_polls;�����&�'����a�8�N�J�&9�$�,�,�&G�D�O��?�?�"r-c�^�|�tj}n|dkrd}nt|dz�}|j�mtj|j
|�}|tjk(rt|j|��tj|j
�|_|jS)z-Internal implementation of wait() on Windows.ri�)
rm�INFINITErhr2�WaitForSingleObjectr��WAIT_TIMEOUTrr��GetExitCodeProcess)r6rO�timeout_millisr�s r.rqzPopen._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�rG)r6�fh�buffers r.�
_readerthreadzPopen._readerthread@s���M�M�"�'�'�)�$��H�H�Jr-c���|jrzt|d�sng|_tj|j
|j|jf��|_d|j_|jj�|jrzt|d�sng|_
tj|j
|j|jf��|_d|j_|jj�|jr|j|�|j�Z|jj|j|��|jj!�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)rCrr�r*�Threadr��
stdout_thread�daemon�startr5r��
stderr_threadr�r�r�r��is_aliverr�rG)r6r�r�r�rCr5s r.r�zPopen._communicateEs���{�{�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�yddl}||jk(r|j�y||jk(r+tj|j|j�y||jk(r+tj|j|j�ytdj|���)�Send a signal to the process.NrzUnsupported signal: {})r2r;�SIGTERM� terminate�CTRL_C_EVENTr�r�r2�CTRL_BREAK_EVENTr=r�)r6�sigr;s r.�send_signalzPopen.send_signalws������*��
��f�n�n�$���� ���+�+�+�������&�"5�"5�6���/�/�/�������&�"9�"9�:� �!9�!@�!@��!E�F�Fr-c���|j�y tj|jd�y#t$r=tj
|j�}|tjk(r�||_YywxYw)zTerminates the process.Nr�)r2rm�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/rhr�rrx�
__stdout__)r6r�rCr5rXrYrZr[r\r]r�s r.r?zPopen._get_handles�s;��!'��G�X� &��G�X� &��G�X��)�)�+�}��=���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�c,�f�X��X��X�'�
'�g,�+�s�I7J'�'J0c���|�tj}i}|r3ddl}g}
dD]#}t||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().Nr)�SIGPIPE�SIGXFZ�SIGXFSZ� setsigdefr}r�r��file_actionsT)r�r�r;r�r��POSIX_SPAWN_CLOSE�POSIX_SPAWN_DUP2rr2rwr�)r6r�rIrMrPrXrYrZr[r\r]r�r;�sigset�signame�signumrr_�fd2s r.�_posix_spawnzPopen._posix_spawn�s(��
�{��j�j���F�����?�G�$�V�W�d�;�F��)��
�
�f�-� @�'-��{�#��L���'�2����8� �'�'��)=�)=�r�(B�C�3��!���1�
��1�
����C�
��8� �'�'��)<�)<�b�#�(F�G�
��)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|dztj&| �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�dirrIs �r.� <genexpr>z'Popen._execute_child.<locals>.<genexpr>`s1�����0>�'<���G�G�L�L����S�)9�:�F�'<�s�=ATiP��:sSubprocessError�0z#Bad exception data from child: {!r}�ascii�znoexec:chdirr��noexec)2r/r7r�r�r�r0r_rrxr��_USE_POSIX_SPAWNr��dirnamer r�r��duprGr�rr=r�
get_exec_path�set�add�
_fork_exec�sortedr�rh�
_USE_VFORKr2rwr�� bytearrayr�r��waitpid�_handle_exitstatusryr2�ChildProcessErrorrrjr�r��builtinsr�
issubclassr�strerror)-r6r�rIrJrKrRrLrMrNrOr�rXrYrZr[r\r]rPrSrTrWrrQr�
unix_shell�orig_executable�errpipe_read�
errpipe_write�low_fds_to_close�low_fd�env_list�kr��executable_list�fds_to_keep�errpipe_data�partr2r��exception_name� hex_errno�err_msg�child_exception_type� errno_num�err_filenames- ` r.rEzPopen._execute_childs�����$��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�D�A�q� "���A��A�#�q�y�&0�1T�&U� U�$�O�O�A��H�r�{�{�1�~�,E�F� %0�$(��!#���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�releaser2r"rr()r6ru�_waitpid�_WNOHANG�_ECHILDr2r��es r.rwzPopen._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!r2r#)r6�
wait_flagsr2r�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|jtj�\}}||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��WNOHANGr2r"r�rr�r��time�sleep)r6rOr��delayr2r�� remainings r.rqzPopen._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�-��+�+��?�?�6�!�,��?�?�"�
&*�^�^�A�%6�
��c��$�(�(�?� �3�3�C�8�,��o�o�-��?�?�"��#!�.�.�6�6�8��,�+�s%�G7�;AG7�H�"4H�7H�Hc�
�|jrD|js8 |jj�|s |jj �d}d}|jsQi|_|jrg|j
|j<|jrg|j
|j<|jr|j
|j}|jr|j
|j}|j|�|jrt|j�}t�5}|jr,|r*|j|jtj�|jr@|jjs*|j|jtj �|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||jjH|jjJ�}|�;|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�rG�_fileobj2outputrCr5�_save_inputr-�
memoryview�_PopenSelector�register� selectors�EVENT_WRITErd�
EVENT_READ�get_mapr�r��RuntimeError�select�fileobj�
_input_offset� _PIPE_BUFr�r�r_r��
unregisterr�r�r�r�r4rlr�r�)r6r�r�r�rCr5�
input_view�selectorrO�ready�key�events�chunkr�s r.r�zPopen._communicates>���z�z�$�"=�"=���J�J�$�$�&����
�
�(�(�*��F��F��.�.�')��$��;�;�8:�D�(�(����5��;�;�8:�D�(�(����5��{�{��-�-�d�k�k�:���{�{��-�-�d�k�k�:�����U�#��{�{�'����4�
��!�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�
(-���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�%(-�!�&�&�(�"�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��="�!�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\r4�encoder�r�)r6r�s r.rQzPopen._save_input|sn���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�r2�ProcessLookupError)r6r�s r.r�zPopen.send_signal�sC��$
�I�I�K����*��
�������#�&��%�
��
�s� A� A�Ac�B�ddl}|j|j�y)z/Terminate the process with SIGTERM
rN)r;r�r�r>s r.r�zPopen.terminate����
����V�^�^�,r-c�B�ddl}|j|j�y)z*Kill the process with SIGKILL
rN)r;r��SIGKILLr>s r.r�z
Popen.kill�rjr-)r}NNNNNTFNNNNrTFr,rH)Fr1)<r)r*r+rJrwr7rlr�r�r�r�rKr�rLrlrnrtrxryr�r�rnr~r�r�r�r�r�r�r�r��contextmanagerr�r�r?r�r�rErmr��
WAIT_OBJECT_0r�rwrqr�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�Tg 4�V8O�+6�)2�
?�-1�8�!�5�<�<� #�F
�& #�Rc $�L H� �@ -� -r-r)ZrJr$r(rBr�rJrxr*r�r�rr�r�r�r9�__all__r@r��ModuleNotFoundErrorrr'rmrrrrrrrrrrrrr r!r"r#r$r%r��_posixsubprocessr'rr!rA�waitstatus_to_exitcoder;�
WIFSTOPPEDr<�WSTOPSIGr=rIrBrZrU� Exceptionrr
rr&rhrbr�r]rrprS�SelectSelectorrvrrrrrr�r�r�rrr�objectrrr�r r
rrrrr,r-r.�<module>rysK�� �D�� � ��
����#����
D�����J����%;�;��
��O�O�O�O�O��N�N� N� O��<��:�:��"$�";�";���m�m���K�K� ��:�:���
���"&����� �����'�i�&�$��$�N�_��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-��m���E������J��s"�F6�G�6G�G�G�G
?>