Hacked By AnonymousFox

Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/subprocess.cpython-35.pyc



��Yf ��@sdZddlZejdkZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZGdd�de
�ZGdd�de�ZGd	d
�d
e�ZerddlZddlZddlZGdd�d�Zn�ddlZddlZddlZyddlZWnek
r[ddlZYnXeed
d�Zeed�r�ejZn	ejZddddddddddddd
dgZ er=ddlm!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(e j)ddddd d!d"d#g�Gd$d%�d%e*�Z+gZ,d&d'�Z-d;Z.d<Z/d=Z0d+d,�Z1d-dd.d�Z2d/d�Z3d-dd0d�Z4Gd1d�de5�Z6d2dd-dd3d4d5d�Z7d6d7�Z8d8d�Z9d9d�Z:e5�Z;Gd:d�de5�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 (status, output) tuple
�N�win32)�	monotonicc@seZdZdS)�SubprocessErrorN)�__name__�
__module__�__qualname__�rr�//opt/alt/python35/lib64/python3.5/subprocess.pyr9src@s[eZdZdZdddd�Zdd�Zedd��Zejd	d��ZdS)
�CalledProcessErrorz�Raised when run() is called with check=True and the process
    returns a non-zero exit status.

    Attributes:
      cmd, returncode, stdout, stderr, output
    NcCs(||_||_||_||_dS)N)�
returncode�cmd�output�stderr)�selfrrr
rrrr	�__init__Cs			zCalledProcessError.__init__cCsd|j|jfS)Nz-Command '%s' returned non-zero exit status %d)rr)rrrr	�__str__IszCalledProcessError.__str__cCs|jS)z+Alias for output attribute, to match stderr)r
)rrrr	�stdoutLszCalledProcessError.stdoutcCs
||_dS)N)r
)r�valuerrr	rQs)	rrr�__doc__rr�propertyr�setterrrrr	r
<s
r
c@s[eZdZdZdddd�Zdd�Zedd��Zejd	d��ZdS)
�TimeoutExpiredz�This exception is raised when the timeout expires while waiting for a
    child process.

    Attributes:
        cmd, output, stdout, stderr, timeout
    NcCs(||_||_||_||_dS)N)r�timeoutr
r)rrrr
rrrr	r_s			zTimeoutExpired.__init__cCsd|j|jfS)Nz'Command '%s' timed out after %s seconds)rr)rrrr	reszTimeoutExpired.__str__cCs|jS)N)r
)rrrr	riszTimeoutExpired.stdoutcCs
||_dS)N)r
)rrrrr	rms)	rrrrrrrrrrrrr	rXs
rc@s.eZdZdZdZdZdZdZdS)�STARTUPINFOrN)rrr�dwFlags�	hStdInput�
hStdOutput�	hStdError�wShowWindowrrrr	rxs
rZPIPE_BUFi�PollSelector�Popen�PIPE�STDOUT�call�
check_call�getstatusoutput�	getoutput�check_output�run�DEVNULL�CompletedProcess)�CREATE_NEW_CONSOLE�CREATE_NEW_PROCESS_GROUP�STD_INPUT_HANDLE�STD_OUTPUT_HANDLE�STD_ERROR_HANDLE�SW_HIDE�STARTF_USESTDHANDLES�STARTF_USESHOWWINDOWr+r,r-r.r/r0r1r2c@sLeZdZdZejdd�Zdd�Zdd�ZeZ	eZ
dS)	�HandleFcCs |jsd|_||�dS)NT)�closed)r�CloseHandlerrr	�Close�s		zHandle.ClosecCs,|jsd|_t|�Std��dS)NTzalready closed)r4�int�
ValueError)rrrr	�Detach�s		
z
Handle.DetachcCsd|jjt|�fS)Nz%s(%d))�	__class__rr7)rrrr	�__repr__�szHandle.__repr__N)rrrr4�_winapir5r6r9r;�__del__rrrrr	r3�sr3cCsfx_tdd�D]M}|jdtj�}|dk	rytj|�Wqtk
r]YqXqWdS)N�
_deadstate)�_active�_internal_poll�sys�maxsize�remover8)Zinst�resrrr	�_cleanup�s
rE���cCs�ddddddddd	d
ddd
dddddi	}g}xM|j�D]?\}}ttj|�}|dkrO|jd||�qOWx"tjD]}|jd|�q�W|S)znReturn a list of command-line arguments reproducing the current
    settings in sys.flags and sys.warnoptions.�debug�d�optimize�O�dont_write_bytecode�B�no_user_site�s�no_site�S�ignore_environment�E�verbose�v�
bytes_warning�b�quiet�qr�-z-W)�items�getattrrA�flags�append�warnoptions)Zflag_opt_map�argsZflagZoptrVrrr	�_args_from_interpreter_flags�s"rbrcOsSt||��=}y|jd|�SWn|j�|j��YnXWdQRXdS)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"])
    rN)r �wait�kill)r�	popenargs�kwargs�prrr	r#�s

cOsMt||�}|rI|jd�}|dkr:|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"])
    raNr)r#�getr
)rerf�retcoderrrr	r$s

c	Osxd|krtd��d|krV|ddkrV|jdd�rLdnd|d<t|dtd	|d
d|�jS)a(Run 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'

    If universal_newlines=True is passed, the "input" argument must be a
    string and the return value will be a string rather than bytes.
    rz3stdout argument not allowed, it will be overridden.�inputN�universal_newlinesF��r�checkT)r8rhr(r!r)rrerfrrr	r's "c@s@eZdZdZdddd�Zdd�Zdd�ZdS)	r*aEA 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).
    NcCs(||_||_||_||_dS)N)rarrr)rrarrrrrr	rJs			zCompletedProcess.__init__cCs�dj|j�dj|j�g}|jdk	rL|jdj|j��|jdk	rt|jdj|j��djt|�jdj|��S)Nz	args={!r}zreturncode={!r}zstdout={!r}zstderr={!r}z{}({})z, )	�formatrarrr_r�typer�join)rrarrr	r;PszCompletedProcess.__repr__cCs.|jr*t|j|j|j|j��dS)z6Raise CalledProcessError if the exit code is non-zero.N)rr
rarr)rrrr	�check_returncodeYs	z!CompletedProcess.check_returncode)rrrrrr;rrrrrr	r*?s
	rjrnFc	Os|dk	r.d|kr$td��t|d<t||���}y|j|d|�\}}Wnjtk
r�|j�|j�\}}t|j|d|d|��Yn|j�|j��YnX|j�}|r|rt	||jd|d|��WdQRXt
|j|||�S)afRun 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.

    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 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.

    The other arguments are the same as for the Popen constructor.

    If universal_newlines=True is passed, the "input" argument must be a
    string and stdout/stderr in the returned object will be strings rather than
    bytes.
    N�stdinz/stdin and input arguments may not both be used.rr
r)r8r!r �communicaterrdrarc�pollr
r*)	rjrrnrerfZprocessrrrirrr	r(`s*





cCs8g}d}x|D]}g}|r2|jd�d|kpNd|kpN|}|rd|jd�x�|D]�}|dkr�|j|�qk|dkr�|jdt|�d�g}|jd�qk|r�|j|�g}|j|�qkW|r|j|�|r|j|�|jd�qWdj|�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� �	�"�\rGz\"rl)r_�len�extendrq)�seq�resultZ	needquote�argZbs_buf�crrr	�list2cmdline�s4






r�cCs�y(t|dddddt�}d}Wn7tk
ra}z|j}|j}WYdd}~XnX|d	d�dkr�|dd
�}||fS)a�    Return (status, output) of executing cmd in a shell.

    Execute the string 'cmd' in a shell with 'check_output' and
    return a 2-tuple (status, output). Universal newlines mode is used,
    meaning that the result with be decoded to a string.

    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')
    (256, 'cat: /bin/junk: No such file or directory')
    >>> subprocess.getstatusoutput('/bin/junk')
    (256, 'sh: /bin/junk: not found')
    �shellTrkrrNrF�
���r�)r'r"r
r
r)r�dataZstatusZexrrr	r%�s
	cCst|�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'
    rF)r%)rrrr	r&�s
c@s5eZdZdZdZd>dddddeddddddddfdd�Zd	d
�Zdd�Zd
d�Z	e
jdd�Zdd�Z
dd�Zdddd�Zdd�Zdd�Zdd�Zerndd�Zdd �Zd!d"�Zdejejejd#d$�Zddd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Z e Z!n�d/d�Zd0d"�Ze"j#e"j$e"j%e"j&e"j'e"j(d1d2�Z)de"j*e"j+e,j-d3d$�Zd4d5�Z.ddd6d&�Zd7d*�Zd8d9�Z/d:d,�Zd;d.�Z d<d=�Z!dS)?r a 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.

      universal_newlines: If true, use universal line endings for file
          objects stdin, stdout and stderr.

      startupinfo and creationflags (Windows only)

      restore_signals (POSIX only)

      start_new_session (POSIX only)

      pass_fds (POSIX only)

    Attributes:
        stdin, stdout, stderr, pid, returncode
    FrFNrTcCs@t�tj�|_d|_d|_|dkr:d}t|t�sUtd��t	r�|dk	rst
d��|dk	p�|dk	p�|dk	}|tkr�|r�d}q�d}q;|r;|r;t
d��ne|tkr�d}|r|rtj
dt�d}|
dk	r#t
d	��|d
kr;t
d��||_d|_d|_d|_d|_d|_||_|j|||�\}}}}}}t	r|dkr�tj|j�d
�}|dkr�tj|j�d
�}|dkrtj|j�d
�}|dkrdtj|d|�|_|rdtj|jd
dd|dk�|_|dkr�tj|d|�|_|r�tj|j�|_|dkr�tj|d|�|_|r�tj|j�|_d|_yD|j||||||
||
||	||||||||�Wn
xLtd|j|j|jf�D])}y|j �WqWt!k
rYqWXqWW|js4g}|t"kr�|j#|�|t"kr�|j#|�|t"kr�|j#|�t$|d�r�|j#|j%�x4|D],}yt&j |�Wqt!k
r/YqXqW�YnXdS)zCreate new Popen instance.NFrFzbufsize must be an integerz0preexec_fn is not supported on Windows platformsTzSclose_fds is not supported on Windows platforms if you redirect stdin/stdout/stderrzpass_fds overriding close_fds.z2startupinfo is only supported on Windows platformsrz4creationflags is only supported on Windows platforms�wbZ
write_through�line_buffering�rb�_devnullr�r�r�r�r�r�r�)'rE�	threadingZLock�
_waitpid_lock�_input�_communication_started�
isinstancer7�	TypeError�
_mswindowsr8�_PLATFORM_DEFAULT_CLOSE_FDS�warnings�warn�RuntimeWarningrarsrr�pidrrk�_get_handles�msvcrtZopen_osfhandler9�io�open�
TextIOWrapper�_closed_child_pipe_fds�_execute_child�filter�close�OSErrorr!r_�hasattrr��os)rra�bufsize�
executablersrr�
preexec_fn�	close_fdsr��cwd�envrk�startupinfo�
creationflags�restore_signals�start_new_session�pass_fdsZ
any_stdio_set�p2cread�p2cwrite�c2pread�c2pwrite�errread�errwrite�fZto_close�fdrrr	r3s�				
							'			(
		




	zPopen.__init__cCs+|j|�}|jdd�jdd�S)Nz
r��
)�decode�replace)rr��encodingrrr	�_translate_newlines�szPopen._translate_newlinescCs|S)Nr)rrrr	�	__enter__�szPopen.__enter__c
CsX|jr|jj�|jr,|jj�z|jrE|jj�Wd|j�XdS)N)rr�rrsrc)rrpr�	tracebackrrr	�__exit__�s	
	
	zPopen.__exit__cCsI|js
dS|jd|�|jdkrEtdk	rEtj|�dS)Nr>)�_child_createdr@rr?r_)rZ_maxsizerrr	r=�s
	z
Popen.__del__cCs1t|d�s*tjtjtj�|_|jS)Nr�)r�r�r��devnull�O_RDWRr�)rrrr	�_get_devnull�szPopen._get_devnullcCs�|rky|jj|�WnNtk
r.Yn=tk
rj}z|jtjkrUn�WYdd}~XnXy|jj�WnNtk
r�Yn=tk
r�}z|jtjkr�n�WYdd}~XnXdS)N)rs�write�BrokenPipeErrorr��errnoZEINVALr�)rrj�excrrr	�_stdin_write�s"

zPopen._stdin_writecCsJ|jr|rtd��|dkr�|jr�|j|j|jgjd�dkr�d}d}|jr}|j|�nM|jr�|jj�}|jj�n%|jr�|jj�}|jj�|j	�ni|dk	r�t
�|}nd}z|j|||�\}}Wdd|_X|j	d|j|��}||fS)a4Interact with process: Send data to stdin.  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 (if self.universal_newlines is True, this should
        be a string; if it is False, "input" should be bytes), or
        None, if no data should be sent to the child.

        communicate() returns a tuple (stdout, stderr).  These will be
        bytes or, if self.universal_newlines was True, a string.
        z.Cannot send input after starting communicationNrGTr)
r�r8rsrr�countr��readr�rc�_time�_communicate�_remaining_time)rrjrrr�endtime�stsrrr	rt�s.'			


zPopen.communicatecCs
|j�S)zSCheck if child process has terminated. Set and return returncode
        attribute.)r@)rrrr	ru,sz
Popen.pollcCs|dkrdS|t�SdS)z5Convenience for _communicate when computing timeouts.N)r�)rr�rrr	r�2szPopen._remaining_timecCs5|dkrdSt�|kr1t|j|��dS)z2Convenience for checking if a timeout has expired.N)r�rra)rr��orig_timeoutrrr	�_check_timeout:szPopen._check_timeoutcCs�|dkr(|dkr(|dkr(d
Sd
\}}d\}}d\}}	|dkr�tjtj�}|dkrDtjdd�\}}
t|�}tj|
�n�|tkr�tjdd�\}}t|�t|�}}nZ|tkrtj	|j
��}n6t|t�r/tj	|�}ntj	|j
��}|j|�}|dkr�tjtj�}|dkrKtjdd�\}
}t|�}tj|
�n�|tkr�tjdd�\}}t|�t|�}}nZ|tkrtj	|j
��}n6t|t�r6tj	|�}ntj	|j
��}|j|�}|dkr�tjtj�}	|	dkrgtjdd�\}
}	t|	�}	tj|
�n�|tkr�tjdd�\}}	t|�t|	�}}	no|tkr
|}	nZ|tkr1tj	|j
��}	n6t|t�rRtj	|�}	ntj	|j
��}	|j|	�}	||||||	fS)z|Construct and return tuple with IO objects:
            p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
            NrFrr�r�r�r�r�r�)r�r�r�r�r�r�r�r�)r�r�r�r�)r�r�r�r�)r�r�)r<ZGetStdHandler-Z
CreatePiper3r5r!r)r�Z
get_osfhandler�r�r7�fileno�_make_inheritabler.r/r")rrsrrr�r�r�r�r�r��_rrr	r�Fsn$	zPopen._get_handlescCs7tjtj�|tj�ddtj�}t|�S)z2Return a duplicate of handle, which is inheritablerrF)r<ZDuplicateHandleZGetCurrentProcessZDUPLICATE_SAME_ACCESSr3)rZhandle�hrrr	r��s
zPopen._make_inheritablecCs�|std��t|t�s.t|�}|dkrCt�}d	|||fkr�|jtjO_||_||_	||_
|
r�|jtjO_tj|_
tjjdd�}dj||�}z>tj||ddt|�|	|||�	\}}}}Wd|d
kr'|j�|dkr=|j�|dkrS|j�t|d�rrtj|j�Xd|_t|�|_||_tj|�dS)
z$Execute program (MS Windows version)z"pass_fds not supported on Windows.NrFZCOMSPECzcmd.exez
{} /c "{}"r�Tr�r�r�r�)�AssertionErrorr��strr�rrr<r1rrrr2r0rr��environrhroZ
CreateProcessr7r6r�r�r�r�r3�_handler�r5)rrar�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zunused_restore_signalsZunused_start_new_sessionZcomspecZhpZhtr��tidrrr	r��sF					



		zPopen._execute_childcCs@|jdkr9||jd�|kr9||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)rr�)rr>Z_WaitForSingleObjectZ_WAIT_OBJECT_0Z_GetExitCodeProcessrrr	r@�szPopen._internal_pollcCs�|dk	r|j|�}|dkr3tj}nt|d�}|jdkr�tj|j|�}|tjkr�t|j	|��tj
|j�|_|jS)zOWait for child process to terminate.  Returns returncode
            attribute.Ni�)r�r<ZINFINITEr7r�WaitForSingleObjectr�ZWAIT_TIMEOUTrra�GetExitCodeProcess)rrr�Ztimeout_millisr}rrr	rc�s	z
Popen.waitcCs!|j|j��|j�dS)N)r_r�r�)rZfh�bufferrrr	�
_readerthread�szPopen._readerthreadcCs�|jret|d�reg|_tjd|jd|j|jf�|_d|j_|jj�|j	r�t|d�r�g|_
tjd|jd|j	|j
f�|_d|j_|jj�|jr�|j
|�|jdk	r)|jj|j|��|jj�r)t|j|��|j	dk	rr|jj|j|��|jj�rrt|j|��d}d}|jr�|j}|jj�|j	r�|j
}|j	j�|dk	r�|d}|dk	r�|d}||fS)N�_stdout_buff�targetraT�_stderr_buffr)rr�r�r�ZThreadr�Z
stdout_threadZdaemon�startrr�Z
stderr_threadrsr�rqr�Zis_aliverrar�)rrjr�r�rrrrr	r��sF	
	
	
		
		


zPopen._communicatecCs�|jdk	rdS|tjkr/|j�ne|tjkrWtj|jtj�n=|tjkrtj|jtj�nt	dj
|���dS)zSend a signal to the process.NzUnsupported signal: {})r�signal�SIGTERM�	terminateZCTRL_C_EVENTr�rdr�ZCTRL_BREAK_EVENTr8ro)r�sigrrr	�send_signal0s
zPopen.send_signalcCsp|jdk	rdSytj|jd�Wn?tk
rktj|j�}|tjkr^�||_YnXdS)zTerminates the process.NrF)rr<ZTerminateProcessr��PermissionErrorr�ZSTILL_ACTIVE)r�rcrrr	r�>s
zPopen.terminatec
Cs�d\}}d\}}d\}}	|dkr3n`|tkrTtj�\}}n?|tkro|j�}n$t|t�r�|}n|j�}|dkr�n`|tkr�tj�\}}n?|tkr�|j�}n$t|t�r�|}n|j�}|dkrn�|tkr2tj�\}}	nr|tkre|dkrS|}	q�t	j
j�}	n?|tkr�|j�}	n$t|t�r�|}	n|j�}	||||||	fS)
z|Construct and return tuple with IO objects:
            p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
            rFNr�r�)r�r�r�r�)r�r�r�r�)r�r�r�)r!r��piper)r�r�r7r�r"rA�
__stdout__)
rrsrrr�r�r�r�r�r�rrr	r�SsJ				c&"s�t|ttf�r!|g}nt|�}|
rSddg|}�rS�|d<�dkri|d��}tj�\}}g}x,|dkr�|j|�tj|�}q�Wx|D]}tj|�q�WzqzO|dk	rQg}xh|j	�D]Q\}}tj
|�}d|kr,td��|j|dtj
|��q�Wnd}tj
���tjj
��r��f}n(t�fdd	�tj|�D��}t|�}|j|�tj|||tttt|���|||||
||||||||�|_d
|_Wdtj|�Xt|dd�}|dkrz|dkrz||krztj|�|dkr�|
dkr�||kr�tj|�|dkr�|dkr�||kr�tj|�|dk	r�tj|�d
|_t�}x:tj|d
�}||7}|s?t|�d
kr
Pq
WWdtj|�X|r�ytj|jd�Wntk
r�YnXy|j dd�\} }!}"Wn.tk
r�d} d}!dt!|�}"YnXtt"| j#d�t$�}#|"j#dd�}"t%|#t&�r�|!r�t|!d�}$|"dk}%|%rAd}"|$dkr�tj'|$�}"|$t(j)kr�|%r�|"dt!|�7}"n|"dt!|�7}"|#|$|"��|#|"��dS) zExecute program (POSIX version)z/bin/shz-crNrH�=z!illegal environment variable namec3s-|]#}tjjtj|���VqdS)N)r��pathrq�fsencode)�.0�dir)r�rr	�	<genexpr>�sz'Popen._execute_child.<locals>.<genexpr>Tr�rFiP��:rGsSubprocessError�0sBad exception data from child: �ascii�errors�
surrogatepass�Znoexecrlz: r�r�r�r�r�r�)*r�r��bytes�listr�r�r_�dupr�r\r�r8r��dirname�tuple�
get_exec_path�set�add�_posixsubprocessZ	fork_exec�sorted�mapr7r�r�r]r��	bytearrayr�rz�waitpid�ChildProcessError�split�repr�builtinsr�r�
issubclassr��strerrorr��ENOENT)&rrar�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zorig_executableZerrpipe_readZ
errpipe_writeZlow_fds_to_closeZlow_fdZenv_list�krVZexecutable_listZfds_to_keepZ
devnull_fdZerrpipe_data�partZexception_nameZ	hex_errnoZerr_msgZchild_exception_typeZ	errno_numZchild_exec_never_calledr)r�r	r��s�	



%

$
$
$

		
	

	cCsl||�r||�|_nI||�r=||�|_n+||�r\||�|_ntd��dS)z:All callers to this function MUST hold self._waitpid_lock.zUnknown child exit status!N)rr)rr�Z_WIFSIGNALEDZ	_WTERMSIGZ
_WIFEXITEDZ_WEXITSTATUSZ_WIFSTOPPEDZ	_WSTOPSIGrrr	�_handle_exitstatus
szPopen._handle_exitstatuscCs�|jdkr�|jjd�s%dSz�yN|jdk	rA|jS||j|�\}}||jkru|j|�WnUtk
r�}z5|dk	r�||_n|j|kr�d|_WYdd}~XnXWd|jj�X|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)rr��acquirer�r
r�r��release)rr>Z_waitpidZ_WNOHANGZ_ECHILDr�r��errr	r@s 	 cCsMytj|j|�\}}Wn!tk
rB|j}d}YnX||fS)z:All callers to this function MUST hold self._waitpid_lock.r)r�rr�r)rZ
wait_flagsr�r�rrr	�	_try_waitBs
	zPopen._try_waitcCs�|jdk	r|jS|dk	s.|dk	re|dkrJt�|}n|dkre|j|�}|dk	r^d}xL|jjd�rzj|jdk	r�P|jtj�\}}||jks�|dks�t	�||jkr�|j
|�PWd|jj�X|j|�}|dkr4t|j
|��t|d|d�}tj|�qzWnhxe|jdkr�|j�F|jdk	r�P|jd�\}}||jkr�|j
|�WdQRXqaW|jS)zOWait for child process to terminate.  Returns returncode
            attribute.Ng����Mb@?FrrGg�������?)rr�r�r�rrr��WNOHANGr�r�r
rrra�min�timeZsleep)rrr�Zdelayr�r�Z	remainingrrr	rcOsB!

c#Cs�|jre|jrey|jj�Wntk
r8YnX|sey|jj�Wntk
rdYnXd}d}|js�i|_|jr�g|j|j<|jr�g|j|j<|jr�|j|j}|jr�|j|j}|j|�|j	rt
|j	�}t��}|jr=|r=|j|jt
j�|jr\|j|jt
j�|jr{|j|jt
j�x�|j�r|j|�}|dk	r�|dkr�t|j|��|j|�}	|j||�x6|	D].\}
}|
j|jkr�||j|jt�}y"|jtj|
j|�7_Wn/tk
rt|j|
j�|
jj�YqX|jt|j	�kr|j|
j�|
jj�q�|
j|j|jfkr�tj|
jd�}
|
s|j|
j�|
jj�|j|
jj|
�q�Wq~WWdQRX|j d|j|��|dk	rZdj!|�}|dk	rudj!|�}|j"r�|dk	r�|j#||jj$�}|dk	r�|j#||jj$�}||fS)Nri�rrm)%rsr��flushr�r�Z_fileobj2outputrr�_save_inputr��
memoryview�_PopenSelector�register�	selectorsZEVENT_WRITEZ
EVENT_READZget_mapr�rra�selectr�Zfileobj�
_input_offset�	_PIPE_BUFr�r�r�Z
unregisterrzr�r_rcrqrkr�r�)rrjr�r�rrZ
input_viewZselectorrZready�keyZevents�chunkr�rrr	r��s�

						
				"

&			cCs^|jrZ|jdkrZd|_||_|jrZ|dk	rZ|jj|jj�|_dS)Nr)rsr�rrk�encoder�)rrjrrr	r�s
		zPopen._save_inputcCs&|jdkr"tj|j|�dS)zSend a signal to the process.N)rr�rdr�)rr�rrr	r��scCs|jtj�dS)z/Terminate the process with SIGTERM
            N)r�r�r�)rrrr	r��scCs|jtj�dS)z*Kill the process with SIGKILL
            N)r�r��SIGKILL)rrrr	rd�sz
Popen.killr�)0rrrrr�r�rr�r�r�rArBr=r�r�rtrur�r�r�r�r�r�r<r�Z
WAIT_OBJECT_0r�r@rcr�r�r�r�rdr��WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUS�
WIFSTOPPED�WSTOPSIGr
rrr�ZECHILDrrrrrr	r s`(	�
1H	=4	6�	"
1_r�������)=rrA�platformr�r�r�rr�rr�r�rr��	Exceptionrr
rr�r�r<rr�rr�ImportErrorZdummy_threadingr]rr�rrZSelectSelector�__all__r+r,r-r.r/r0r1r2r{r7r3r?rEr!r"r)rbr#r$r'�objectr*r(r�r%r&r�r rrrr	�<module>*sn
	:
,!2I
	

Hacked By AnonymousFox1.0, Coded By AnonymousFox