Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 18.118.93.246
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : subprocess.cpython-32.pyo
l
��bc@s�dZddlZejdkZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZGd�de�Z
er�ddlZddlZddlZGd�d�ZGd�d	�Zn�ddlZeed
�ZddlZddlZyddlZWn(ek
rNeZe
jde�YnXeedd
�Zeedd�Zd�Z er�ej!Z"n	d�Z"dddddddddg	Z#er ddlm$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+e#j,dddddd d!d"g�nyej-d#�Z.Wnd$Z.YnXgZ/d%�Z0dZ1d&Z2d'�Z3d(�Z4d)�Z5d*�Z6d+�Z7d,�Z8d-�Z9e:�Z;Gd.�de:�Z<d/�Z=d0�Z>e?d1kr�er�e>�ne=�ndS(2u�,subprocess - 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.  This module
intends to replace several other, older modules and functions, like:

os.system
os.spawn*

Information about how the subprocess module can be used to replace these
modules and functions can be found below.



Using the subprocess module
===========================
This module defines one class called Popen:

class Popen(args, bufsize=-1, executable=None,
            stdin=None, stdout=None, stderr=None,
            preexec_fn=None, close_fds=True, shell=False,
            cwd=None, env=None, universal_newlines=False,
            startupinfo=None, creationflags=0,
            restore_signals=True, start_new_session=False, pass_fds=()):


Arguments are:

args should be a string, or a sequence of program arguments.  The
program to execute is normally the first item in the args sequence or
string, but can be explicitly set by using the executable argument.

On POSIX, with shell=False (default): In this case, the Popen class
uses os.execvp() to execute the child program.  args should normally
be a sequence.  A string will be treated as a sequence with the string
as the only item (the program to execute).

On POSIX, with shell=True: If args is a string, it specifies the
command string to execute through the shell.  If args is a sequence,
the first item specifies the command string, and any additional items
will be treated as additional shell arguments.

On Windows: the Popen class uses CreateProcess() to execute the child
program, which operates on strings.  If args is a sequence, it will be
converted to a string using the list2cmdline method.  Please note that
not all MS Windows applications interpret the command line the same
way: The list2cmdline is designed for applications using the same
rules as the MS C runtime.

bufsize will be supplied as the corresponding argument to the io.open()
function when creating the stdin/stdout/stderr pipe file objects:
0 means unbuffered (read & write are one system call and can return short),
1 means line buffered, any other positive value means use a buffer of
approximately that size.  A negative bufsize, the default, means the system
default of io.DEFAULT_BUFFER_SIZE will be used.

stdin, stdout and stderr specify the executed programs' standard
input, standard output and standard error file handles, respectively.
Valid values are PIPE, an existing file descriptor (a positive
integer), an existing file object, and None.  PIPE indicates that a
new pipe to the child should be created.  With None, no redirection
will occur; the child's file handles will be inherited from the
parent.  Additionally, stderr can be STDOUT, which indicates that the
stderr data from the applications should be captured into the same
file handle as for stdout.

On POSIX, if preexec_fn is set to a callable object, this object will be
called in the child process just before the child is executed.  The use
of preexec_fn is not thread safe, using it in the presence of threads
could lead to a deadlock in the child process before the new executable
is executed.

If close_fds is true, all file descriptors except 0, 1 and 2 will be
closed before the child process is executed.  The default for close_fds
varies by platform:  Always true on POSIX.  True when stdin/stdout/stderr
are None on Windows, false otherwise.

pass_fds is an optional sequence of file descriptors to keep open between the
parent and child.  Providing any pass_fds implicitly sets close_fds to true.

if shell is true, the specified command will be executed through the
shell.

If cwd is not None, the current directory will be changed to cwd
before the child is executed.

On POSIX, if restore_signals is True all signals that Python sets to
SIG_IGN are restored to SIG_DFL in the child process before the exec.
Currently this includes the SIGPIPE, SIGXFZ and SIGXFSZ signals.  This
parameter does nothing on Windows.

On POSIX, if start_new_session is True, the setsid() system call will be made
in the child process prior to executing the command.

If env is not None, it defines the environment variables for the new
process.

If universal_newlines is true, the file objects stdout and stderr are
opened as a text files, but lines may be terminated by any of '\n',
the Unix end-of-line convention, '\r', the old Macintosh convention or
'\r\n', the Windows convention.  All of these external representations
are seen as '\n' by the Python program.  Also, the newlines attribute
of the file objects stdout, stdin and stderr are not updated by the
communicate() method.

The startupinfo and creationflags, if given, will be passed to the
underlying CreateProcess() function.  They can specify things such as
appearance of the main window and priority for the new process.
(Windows only)


This module also defines some shortcut functions:

call(*popenargs, **kwargs):
    Run command with arguments.  Wait for command to complete, then
    return the returncode attribute.

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

    >>> retcode = subprocess.call(["ls", "-l"])

check_call(*popenargs, **kwargs):
    Run 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 Popen constructor.  Example:

    >>> subprocess.check_call(["ls", "-l"])
    0

getstatusoutput(cmd):
    Return (status, output) of executing cmd in a shell.

    Execute the string 'cmd' in a shell with os.popen() and return a 2-tuple
    (status, output).  cmd is actually run as '{ cmd ; } 2>&1', so that the
    returned output will contain output or error messages. A trailing newline
    is stripped from the output. The exit status for the command can be
    interpreted according to the rules for the C function wait().  Example:

    >>> 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')

getoutput(cmd):
    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:

    >>> subprocess.getoutput('ls /bin/ls')
    '/bin/ls'

check_output(*popenargs, **kwargs):
    Run command with arguments and return its output as a byte string.

    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:

    >>> output = subprocess.check_output(["ls", "-l", "/dev/null"])


Exceptions
----------
Exceptions raised in the child process, before the new program has
started to execute, will be re-raised in the parent.  Additionally,
the exception object will have one extra attribute called
'child_traceback', which is a string containing traceback information
from the childs point of view.

The most common exception raised is OSError.  This occurs, for
example, when trying to execute a non-existent file.  Applications
should prepare for OSErrors.

A ValueError will be raised if Popen is called with invalid arguments.

check_call() and check_output() will raise CalledProcessError, if the
called process returns a non-zero return code.


Security
--------
Unlike some other popen functions, this implementation will never call
/bin/sh implicitly.  This means that all characters, including shell
metacharacters, can safely be passed to child processes.


Popen objects
=============
Instances of the Popen class have the following methods:

poll()
    Check if child process has terminated.  Returns returncode
    attribute.

wait()
    Wait for child process to terminate.  Returns returncode attribute.

communicate(input=None)
    Interact 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 a string to be
    sent to the child process, or None, if no data should be sent to
    the child.

    communicate() returns a tuple (stdout, stderr).

    Note: The data read is buffered in memory, so do not use this
    method if the data size is large or unlimited.

The following attributes are also available:

stdin
    If the stdin argument is PIPE, this attribute is a file object
    that provides input to the child process.  Otherwise, it is None.

stdout
    If the stdout argument is PIPE, this attribute is a file object
    that provides output from the child process.  Otherwise, it is
    None.

stderr
    If the stderr argument is PIPE, this attribute is file object that
    provides error output from the child process.  Otherwise, it is
    None.

pid
    The process ID of the child process.

returncode
    The child return code.  A None value indicates that the process
    hasn't terminated yet.  A negative value -N indicates that the
    child was terminated by signal N (POSIX only).


Replacing older functions with the subprocess module
====================================================
In this section, "a ==> b" means that b can be used as a replacement
for a.

Note: All functions in this section fail (more or less) silently if
the executed program cannot be found; this module raises an OSError
exception.

In the following examples, we assume that the subprocess module is
imported with "from subprocess import *".


Replacing /bin/sh shell backquote
---------------------------------
output=`mycmd myarg`
==>
output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0]


Replacing shell pipe line
-------------------------
output=`dmesg | grep hda`
==>
p1 = Popen(["dmesg"], stdout=PIPE)
p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE)
output = p2.communicate()[0]


Replacing os.system()
---------------------
sts = os.system("mycmd" + " myarg")
==>
p = Popen("mycmd" + " myarg", shell=True)
pid, sts = os.waitpid(p.pid, 0)

Note:

* Calling the program through the shell is usually not required.

* It's easier to look at the returncode attribute than the
  exitstatus.

A more real-world example would look like this:

try:
    retcode = call("mycmd" + " myarg", shell=True)
    if retcode < 0:
        print("Child was terminated by signal", -retcode, file=sys.stderr)
    else:
        print("Child returned", retcode, file=sys.stderr)
except OSError as e:
    print("Execution failed:", e, file=sys.stderr)


Replacing os.spawn*
-------------------
P_NOWAIT example:

pid = os.spawnlp(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg")
==>
pid = Popen(["/bin/mycmd", "myarg"]).pid


P_WAIT example:

retcode = os.spawnlp(os.P_WAIT, "/bin/mycmd", "mycmd", "myarg")
==>
retcode = call(["/bin/mycmd", "myarg"])


Vector example:

os.spawnvp(os.P_NOWAIT, path, args)
==>
Popen([path] + args[1:])


Environment example:

os.spawnlpe(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg", env)
==>
Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"})
iNuwin32cBs)|EeZdZdd�Zd�ZdS(u�This exception is raised when a process run by check_call() or
    check_output() returns a non-zero exit status.
    The exit status will be stored in the returncode attribute;
    check_output() will also store the output in the output attribute.
    cCs||_||_||_dS(N(u
returncodeucmduoutput(uselfu
returncodeucmduoutput((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu__init__ds		cCsd|j|jfS(Nu-Command '%s' returned non-zero exit status %d(ucmdu
returncode(uself((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu__str__hsN(u__name__u
__module__u__doc__uNoneu__init__u__str__(u
__locals__((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyuCalledProcessError^s
uCalledProcessErrorcBs,|EeZdZdZdZdZdZdS(iN(u__name__u
__module__udwFlagsuNoneu	hStdInputu
hStdOutputu	hStdErroruwShowWindow(u
__locals__((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyuSTARTUPINFOps

uSTARTUPINFOcBs|EeZeZdS(N(u__name__u
__module__uIOErroruerror(u
__locals__((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu
pywintypesvs
u
pywintypesupolluqThe _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.uPIPE_BUFiu
FD_CLOEXECicCsWtj|tj�}|r8tj|tj|tB�ntj|tj|t@�dS(N(ufcntluF_GETFDuF_SETFDu_FD_CLOEXEC(ufducloexecuold((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_set_cloexec�scCs2tj�}t|dd�t|dd�|S(NiiT(uosupipeu_set_cloexecuTrue(ufds((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_create_pipe�suPopenuPIPEuSTDOUTucallu
check_callugetstatusoutputu	getoutputucheck_output(uCREATE_NEW_CONSOLEuCREATE_NEW_PROCESS_GROUPuSTD_INPUT_HANDLEuSTD_OUTPUT_HANDLEuSTD_ERROR_HANDLEuSW_HIDEuSTARTF_USESTDHANDLESuSTARTF_USESHOWWINDOWuCREATE_NEW_CONSOLEuCREATE_NEW_PROCESS_GROUPuSTD_INPUT_HANDLEuSTD_OUTPUT_HANDLEuSTD_ERROR_HANDLEuSW_HIDEuSTARTF_USESTDHANDLESuSTARTF_USESHOWWINDOWuSC_OPEN_MAXicCsixbtdd�D]P}|jdtj�}|dk	rytj|�Wqatk
r]YqaXqqWdS(Nu
_deadstate(u_activeu_internal_pollusysumaxsizeuNoneuremoveu
ValueError(uinstures((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_cleanup�s
icGsaxZy||�SWqttfk
rY}z |jtjkrDwn�WYdd}~XqXqdS(N(uOSErroruIOErroruerrnouEINTR(ufuncuargsue((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_eintr_retry_call�scOst||�j�S(u�Run command with arguments.  Wait for command to complete, then
    return the returncode attribute.

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

    retcode = call(["ls", "-l"])
    (uPopenuwait(u	popenargsukwargs((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyucall�scOsSt||�}|rO|jd�}|dkr=|d}nt||��ndS(uSRun 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 Popen constructor.  Example:

    check_call(["ls", "-l"])
    uargsiN(ucallugetuNoneuCalledProcessError(u	popenargsukwargsuretcodeucmd((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu
check_call�s

cOs�d|krtd��ntdt||�}|j�\}}|j�}|r�|jd�}|dkr||d}nt||d|��n|S(uRun command with arguments and return its output as a byte string.

    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'
    ustdoutu3stdout argument not allowed, it will be overridden.uargsiuoutputN(u
ValueErroruPopenuPIPEucommunicateupollugetuNoneuCalledProcessError(u	popenargsukwargsuprocessuoutputu
unused_erruretcodeucmd((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyucheck_output�s
cCsGg}d}x+|D]#}g}|r5|jd�nd|kpQd|kpQ|}|rj|jd�nx�|D]�}|dkr�|j|�qq|dkr�|jdt|�d�g}|jd�qq|r�|j|�g}n|j|�qqW|r|j|�n|r|j|�|jd�qqWdj|�S(	u�
    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.
    u u	u"u\iu\"uF(uFalseuappendulenuextendujoin(usequresultu	needquoteuargubs_bufuc((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyulist2cmdline
s4


	
cCsztjd|dd�}|j�}|j�}|dkrGd}n|dd�dkrp|dd	�}n||fS(
u�Return (status, output) of executing cmd in a shell.

    Execute the string 'cmd' in a shell with os.popen() and return a 2-tuple
    (status, output).  cmd is actually run as '{ cmd ; } 2>&1', so that the
    returned output will contain output or error messages.  A trailing newline
    is stripped from the output.  The exit status for the command can be
    interpreted according to the rules for the C 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')
    u{ u; } 2>&1uriiNu
i����i����(uosupopenureaducloseuNone(ucmdupipeutextusts((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyugetstatusoutputWs	cCst|�dS(u%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'
    i(ugetstatusoutput(ucmd((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu	getoutputps
cBs�|EeZd ddddded!ddd!ddd"d!d#d�Zd�Zd�Zd�Z	e
jed�Z
dd�Zd�Zerd	�Zd
�Zd�Zd�Zdejejejd
�Zd�Zd�Zd�Zd�Zd�ZeZn�d�Zd�Z d�Ze!j"e!j#e!j$e!j%d�Z&de!j'e!j(e!j)e*j+d�Zd�Zd�Zd�Z,d�Z-d�Zd�Zd�ZdS($iicCs't�d
|_|dkr%d}nt|t�sCtd��ntr�|dk	rdtd��n|dk	p�|dk	p�|dk	}|t	kr�|r�d
}q�d}q;|r;|r;td��q;nq|t	kr�d}n|r|rtjdt
�d}n|
dk	r td��n|dkr;td��nd|_d|_d|_d|_d|_||_|j|||�\}}}}}}tr|dkr�tj|j�d�}n|dkr�tj|j�d�}n|dkrtj|j�d�}qn|dkrdtj|d	|�|_|jrdtj|jd
d�|_qdn|dkr�tj|d|�|_|r�tj|j�|_q�n|dkr�tj|d|�|_|r�tj|j�|_q�nyG|j||||||
|||
||	||||||||�Wn�xLtd|j|j|jf�D])}y|j�Wq]tk
r�Yq]Xq]Wg}|tkr�|j |�n|tkr�|j |�n|tkr�|j |�nx4|D],}yt!j|�Wq�tk
rYq�Xq�W�YnXdS(uCreate new Popen instance.iubufsize must be an integeru0preexec_fn is not supported on Windows platformsuSclose_fds is not supported on Windows platforms if you redirect stdin/stdout/stderrupass_fds overriding close_fds.u2startupinfo is only supported on Windows platformsiu4creationflags is only supported on Windows platformsuwbu
write_throughurbNFi����Ti����i����i����i����i����i����("u_cleanupuFalseu_child_createduNoneu
isinstanceuintu	TypeErroru	mswindowsu
ValueErroru_PLATFORM_DEFAULT_CLOSE_FDSuTrueuwarningsuwarnuRuntimeWarningustdinustdoutustderrupidu
returncodeuuniversal_newlinesu_get_handlesumsvcrtuopen_osfhandleuDetachuiouopenu
TextIOWrapperu_execute_childufilterucloseuEnvironmentErroruPIPEuappenduos(uselfuargsubufsizeu
executableustdinustdoutustderru
preexec_fnu	close_fdsushellucwduenvuuniversal_newlinesustartupinfou
creationflagsurestore_signalsustart_new_sessionupass_fdsu
any_stdio_setup2creadup2cwriteuc2preaduc2pwriteuerrreaduerrwriteufuto_closeufd((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu__init__�s�					
							'	!	(
	

	cCs+|j|�}|jdd�jdd�S(Nu
u
u
(udecodeureplace(uselfudatauencoding((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_translate_newlinesscCs|S(N((uself((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu	__enter__scCsY|jr|jj�n|jr2|jj�n|jrK|jj�n|j�dS(N(ustdoutucloseustderrustdinuwait(uselfutypeuvalueu	traceback((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu__exit__	s			cCsUt|dd�sdS|jd|�|jdkrQ|dk	rQ|j|�ndS(Nu_child_createdu
_deadstateF(ugetattruFalseu_internal_pollu
returncodeuNoneuappend(uselfu_maxsizeu_active((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu__del__s
cCs2|j|j|jgjd�dkr%d}d}|jr�|r�y|jj|�Wq�tk
r�}z/|jtjkr�|jtj	kr��nWYdd}~Xq�Xn|jj
�nV|jr�t|jj�}|jj
�n+|jrt|jj�}|jj
�n|j
�||fS|j|�S(ufInteract 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 a
        string to be sent to the child process, or None, if no data
        should be sent to the child.

        communicate() returns a tuple (stdout, stderr).iN(ustdinustdoutustderrucountuNoneuwriteuIOErroruerrnouEPIPEuEINVALucloseu_eintr_retry_callureaduwaitu_communicate(uselfuinputustdoutustderrue((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyucommunicate!s('	$		

cCs
|j�S(N(u_internal_poll(uself((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyupollCscCs�|dkr:|dkr:|dkr:dddddd	fSd
d}}dd
}}dd}}	|dkr�tjtj�}|dkrtjdd�\}}
qn]|tkr�tjdd�\}}n6t|t�r�tj	|�}ntj	|j
��}|j|�}|dkr]tjtj�}|dkr�tjdd�\}
}q�n]|tkr�tjdd�\}}n6t|t�r�tj	|�}ntj	|j
��}|j|�}|dkrtjtj
�}	|	dkr�tjdd�\}
}	q�nr|tkr8tjdd�\}}	nK|tkrM|}	n6t|t�rntj	|�}	ntj	|j
��}	|j|	�}	||||||	fS(u|Construct and return tuple with IO objects:
            p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
            iiNi����i����i����i����i����i����i����i����i����i����i����i����(uNoneu_subprocessuGetStdHandleuSTD_INPUT_HANDLEu
CreatePipeuPIPEu
isinstanceuintumsvcrtu
get_osfhandleufilenou_make_inheritableuSTD_OUTPUT_HANDLEuSTD_ERROR_HANDLEuSTDOUT(uselfustdinustdoutustderrup2creadup2cwriteuc2preaduc2pwriteuerrreaduerrwriteu_((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_get_handlesKsP$


	cCs+tjtj�|tj�ddtj�S(u2Return a duplicate of handle, which is inheritableii(u_subprocessuDuplicateHandleuGetCurrentProcessuDUPLICATE_SAME_ACCESS(uselfuhandle((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_make_inheritable�scCs�tjjtjjtjd��d�}tjj|�s�tjjtjjtj�d�}tjj|�s�t	d��q�n|S(u,Find and return absolut path to w9xpopen.exeiuw9xpopen.exeuZCannot locate w9xpopen.exe, which is needed for Popen to work with your shell or platform.(
uosupathujoinudirnameu_subprocessuGetModuleFileNameuexistsusysuexec_prefixuRuntimeError(uselfuw9xpopen((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_find_w9xpopen�s			cCst|t�st|�}n|	dkr6t�}	nd	|||fkr{|	jtjO_||	_||	_	||	_
n|r%|	jtjO_tj|	_
tjjdd�}dj||�}tj�dks�tjj|�j�dkr%|j�}d||f}|
tjO}
q%nz|y>tj||ddt|�|
|||	�	\}}}}Wn7tjk
r�}zt|j��WYdd}~XnXWd|d
kr�|j�n|dkr�|j�n|dkr�|j�nXd
|_ ||_!||_"|j�dS(u$Execute program (MS Windows version)iuCOMSPECucmd.exeu
{} /c "{}"I�ucommand.comu"%s" %sNi����i����i����i����T(#u
isinstanceustrulist2cmdlineuNoneuSTARTUPINFOudwFlagsu_subprocessuSTARTF_USESTDHANDLESu	hStdInputu
hStdOutputu	hStdErroruSTARTF_USESHOWWINDOWuSW_HIDEuwShowWindowuosuenvironugetuformatu
GetVersionupathubasenameuloweru_find_w9xpopenuCREATE_NEW_CONSOLEu
CreateProcessuintu
pywintypesuerroruWindowsErroruargsuCloseuTrueu_child_createdu_handleupid(uselfuargsu
executableu
preexec_fnu	close_fdsupass_fdsucwduenvuuniversal_newlinesustartupinfou
creationflagsushellup2creadup2cwriteuc2preaduc2pwriteuerrreaduerrwriteuunused_restore_signalsuunused_start_new_sessionucomspecuw9xpopenuhpuhtupidutidue((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_execute_child�sP		
&

			cCsF|jdkr?||jd�|kr?||j�|_q?n|jS(u�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.

            iN(u
returncodeuNoneu_handle(uselfu
_deadstateu_WaitForSingleObjectu_WAIT_OBJECT_0u_GetExitCodeProcess((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_internal_poll�scCsD|jdkr=tj|jtj�tj|j�|_n|jS(uOWait for child process to terminate.  Returns returncode
            attribute.N(u
returncodeuNoneu_subprocessuWaitForSingleObjectu_handleuINFINITEuGetExitCodeProcess(uself((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyuwait�s

cCs!|j|j��|j�dS(N(uappendureaduclose(uselfufhubuffer((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu
_readerthreadscCs�d}d}|jrUg}tjd|jd|j|f�}d|_|j�n|jr�g}tjd|jd|j|f�}d|_|j�n|j	r|dk	r
y|j	j
|�Wq
tk
r}z|jtj
kr��nWYdd}~Xq
Xn|j	j�n|jr0|j�n|jrF|j�n|dk	r_|d}n|dk	rx|d}n|j�||fS(NutargetuargsiT(uNoneustdoutu	threadinguThreadu
_readerthreaduTrueudaemonustartustderrustdinuwriteuIOErroruerrnouEPIPEucloseujoinuwait(uselfuinputustdoutustderru
stdout_threadu
stderr_threadue((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_communicates@		
		
		
	



cCs�|tjkr|j�ne|tjkrDtj|jtj�n=|tjkrltj|jtj�ntdj	|���dS(u)Send a signal to the process
            uUnsupported signal: {}N(
usignaluSIGTERMu	terminateuCTRL_C_EVENTuosukillupiduCTRL_BREAK_EVENTu
ValueErroruformat(uselfusig((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyusend_signal4s
cCs�ytj|jd�Wnjtk
r�}zJ|jdkrA�ntj|j�}|tjkrh�n||_WYdd}~XnXdS(u#Terminates the process
            iiN(u_subprocessuTerminateProcessu_handleuOSErroruwinerroruGetExitCodeProcessuSTILL_ACTIVEu
returncode(uselfueurc((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu	terminate@sc
CsEdd}}dd}}dd}}	|dkr6nB|tkrTt�\}}n$t|t�rl|}n|j�}|dkr�nB|tkr�t�\}}n$t|t�r�|}n|j�}|dkr�nW|tkr�t�\}}	n9|tkr|}	n$t|t�r#|}	n|j�}	||||||	fS(	u|Construct and return tuple with IO objects:
            p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
            ii����i����i����i����i����i����N(uNoneuPIPEu_create_pipeu
isinstanceuintufilenouSTDOUT(
uselfustdinustdoutustderrup2creadup2cwriteuc2preaduc2pwriteuerrreaduerrwrite((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_get_handlesUs:


				cCsid}x=t|�D]/}||krtj||�|d}qqW|tkretj|t�ndS(Nii(usorteduosu
closerangeuMAXFD(uselfufds_to_keepustart_fdufd((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu
_close_fds�sc->skt|t�r|g}nt|�}|rSddg|}�rS�|d<qSn�d
krl|d�n�}t�\}}z7z_trw|d
k	r�d�|j�D�}nd
}tj���tj	j
��r��f}n%t�fd�tj|�D��}t
|�}|j|�tj|||t|�||||
|||||||||�|_d|_nktj�}tj�ytj�|_Wn|r�tj�n�YnXd|_|jdkr�d}y8|
dkr�tj|
�n|dkrtj|�n|d kr6tj|�ntj|�|dkratj|�}n|dksy|dkr�tj|�}nd�}||d�||d�||d�t
�}xL|||gD];}|dkr�||kr�tj|�|j|�q�q�W|rBt
|�}|j|�|j|�n|d
k	r^tj|�n|r�d!}x?|D]4} tt| �rqtjt t| �tj!�qqqqWn|r�ttd�r�tj"�nd}|r�|�n|d
krtj#�|�ntj$�||�Wn�y�t%j&�d
d�\}!}"t|"t'�rW|"j(}#nd}#|sld}"nd|!j)|#|"f}$|$j*dd�}$tj+||$�Wnt,k
r�YnXYnXtj-d�n|r�tj�nWd
tj|�X|d"kr|
d#krtj|�n|d$krD|d%krDtj|�n|d&krl|d'krltj|�nt.�}%x?t/tj0|d�}&|%|&7}%|&s�t1|%�dkrxPqxqxWd
tj|�X|%rgyt/tj2|jd�Wn=t'k
r(}'z|'j(t(j3kr�nWYd
d
}'~'XnXy|%j4dd�\}(})}*Wn.t5k
rxd}(d})dt6|%�}*YnXt t7|(j8d�t9�}+|*j8dd�}*t:|+t'�rX|)rXt;|)d�}#|*dk},|,r�d}*n|#dkrFtj<|#�}*|#t(j=krF|,r,|*dt6|�7}*qC|*dt6|�7}*qFn|+|#|*��n|+|*��nd
S((uExecute program (POSIX version)u/bin/shu-cicSs6g|],\}}tj|�dtj|��qS(s=(uosufsencode(u.0ukuv((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu
<listcomp>�s	c3s-|]#}tjjtj|���VqdS(N(uosupathujoinufsencode(u.0udir(u
executable(u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu	<genexpr>�sicSs?||krt|d�n|dkr;tj||�ndS(NiFi����(u_set_cloexecuFalseuosudup2(uaub((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_dup2�siuSIGPIPEuSIGXFZuSIGXFSZusetsidNunoexecu%s:%x:%suerrorsu
surrogatepassi�iP�s:sRuntimeErrors0sBad exception data from child: uasciiiuu: TFi����i����i����(uSIGPIPEuSIGXFZuSIGXFSZi����i����i����i����i����i����(>u
isinstanceustrulistuNoneu_create_pipeu_posixsubprocessuitemsuosufsencodeupathudirnameutupleu
get_exec_pathusetuaddu	fork_execusortedupiduTrueu_child_createdugcu	isenabledudisableuforkuenableuFalseucloseudupu
_close_fdsuchdiruhasattrusignalugetattruSIG_DFLusetsiduexecvpuexecvpeusysuexc_infouOSErroruerrnou__name__uencodeuwriteu	Exceptionu_exitu	bytearrayu_eintr_retry_callureadulenuwaitpiduECHILDusplitu
ValueErrorureprubuiltinsudecodeuRuntimeErroru
issubclassuintustrerroruENOENT(-uselfuargsu
executableu
preexec_fnu	close_fdsupass_fdsucwduenvuuniversal_newlinesustartupinfou
creationflagsushellup2creadup2cwriteuc2preaduc2pwriteuerrreaduerrwriteurestore_signalsustart_new_sessionuorig_executableuerrpipe_readu
errpipe_writeuenv_listuexecutable_listufds_to_keepugc_was_enabledureached_preexecu_dup2uclosedufdusignalsusiguexc_typeu	exc_valueu	errno_numumessageuerrpipe_dataupartueuexception_nameu	hex_errnouerr_msguchild_exception_typeuchild_exec_never_called((u
executableu1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_execute_child�s&	



	
	


	




		


	

		cCsM||�r||�|_n*||�r=||�|_ntd��dS(NuUnknown child exit status!(u
returncodeuRuntimeError(uselfustsu_WIFSIGNALEDu	_WTERMSIGu
_WIFEXITEDu_WEXITSTATUS((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_handle_exitstatusvs
c	Cs�|jdkr�y;||j|�\}}||jkrI|j|�nWq�|k
r�}z8|dk	rw||_n|j|kr�d|_nWYdd}~Xq�Xn|jS(u�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).

            iN(u
returncodeuNoneupidu_handle_exitstatusuerrno(	uselfu
_deadstateu_waitpidu_WNOHANGu	_os_erroru_ECHILDupidustsue((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_internal_poll�s	"cCs�x�|jdkr�y"ttj|jd�\}}WnLtk
r�}z,|jtjkra�n|j}d}WYdd}~XnX||jkr|j	|�qqW|jS(uOWait for child process to terminate.  Returns returncode
            attribute.iN(
u
returncodeuNoneu_eintr_retry_calluosuwaitpidupiduOSErroruerrnouECHILDu_handle_exitstatus(uselfupidustsue((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyuwait�s"	cCs|jr/|jj�|s/|jj�q/ntrM|j|�\}}n|j|�\}}|dk	r�dj|�}n|dk	r�dj|�}n|jr�|dk	r�|j	||j
j�}n|dk	r�|j	||jj�}q�n|j
�||fS(Ns(ustdinuflushucloseu	_has_pollu_communicate_with_pollu_communicate_with_selectuNoneujoinuuniversal_newlinesu_translate_newlinesustdoutuencodingustderruwait(uselfuinputustdoutustderr((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_communicate�s(	
			
c!s�d}d}i�i}tj����fd�}��fd�}|jrm|rm||jtj�ntjtjB}|jr�||j|�g||jj�<}n|j	r�||j	|�g||j	j�<}nd}|j
rt|t�r|j
|jj�}nxo�r�y�j�}	WnGtjk
r{}
z$|
jdtjkrfwn�WYdd}
~
XnXx|	D]\}}|tj@r6|||t�}
y|tj||
�7}WnGtk
r}
z'|
jtjkr�||�n�WYdd}
~
Xq�X|t|�kr�||�q�q�||@rytj|d�}|se||�n||j|�q�||�q�WqW||fS(Ncs*�j|j�|�|�|j�<dS(N(uregisterufileno(ufile_obju	eventmask(ufd2fileupoller(u1/usr/local/python-3.2/lib/python3.2/subprocess.pyuregister_and_append�scs,�j|��|j��j|�dS(N(u
unregisterucloseupop(ufd(ufd2fileupoller(u1/usr/local/python-3.2/lib/python3.2/subprocess.pyuclose_unregister_and_remove�s
ii(uNoneuselectupollustdinuPOLLOUTuPOLLINuPOLLPRIustdoutufilenoustderruuniversal_newlinesu
isinstanceustruencodeuencodinguerroruargsuerrnouEINTRu	_PIPE_BUFuosuwriteuOSErroruEPIPEulenureaduappend(uselfuinputustdoutustderru	fd2outputuregister_and_appenduclose_unregister_and_removeuselect_POLLIN_POLLPRIuinput_offsetureadyueufdumodeuchunkudata((ufd2fileupolleru1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_communicate_with_poll�sX			



c"Cs�g}g}d}d}|jr:|r:|j|j�n|jr\|j|j�g}n|jr~|j|j�g}nd}|jr�t|t�r�|j|jj	�}nx|s�|r�y"t
j
||g�\}}}	WnGt
jk
r.}
z$|
jdt
jkrw�n�WYdd}
~
XnX|j|kr
|||t�}ytj|jj�|�}WnZtk
r�}
z:|
j
t
jkr�|jj�|j|j�n�WYdd}
~
Xq
X||7}|t|�kr
|jj�|j|j�q
n|j|krmtj|jj�d�}
|
s]|jj�|j|j�n|j|
�n|j|kr�tj|jj�d�}
|
s�|jj�|j|j�n|j|
�q�q�W||fS(Nii(uNoneustdinuappendustdoutustderruuniversal_newlinesu
isinstanceustruencodeuencodinguselectuerroruargsuerrnouEINTRu	_PIPE_BUFuosuwriteufilenouOSErroruEPIPEucloseuremoveulenuread(uselfuinputuread_setu	write_setustdoutustderruinput_offseturlistuwlistuxlistueuchunku
bytes_writtenudata((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_communicate_with_selects`				"




cCstj|j|�dS(u)Send a signal to the process
            N(uosukillupid(uselfusig((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyusend_signalUscCs|jtj�dS(u/Terminate the process with SIGTERM
            N(usend_signalusignaluSIGTERM(uself((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu	terminateZscCs|jtj�dS(u*Kill the process with SIGKILL
            N(usend_signalusignaluSIGKILL(uself((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyukill_sNi����FT((.u__name__u
__module__uNoneu_PLATFORM_DEFAULT_CLOSE_FDSuFalseuTrueu__init__u_translate_newlinesu	__enter__u__exit__usysumaxsizeu_activeu__del__ucommunicateupollu	mswindowsu_get_handlesu_make_inheritableu_find_w9xpopenu_execute_childu_subprocessuWaitForSingleObjectu
WAIT_OBJECT_0uGetExitCodeProcessu_internal_polluwaitu
_readerthreadu_communicateusend_signalu	terminateukillu
_close_fdsuosuWIFSIGNALEDuWTERMSIGu	WIFEXITEDuWEXITSTATUSu_handle_exitstatusuwaitpiduWNOHANGuerroruerrnouECHILDu_communicate_with_pollu_communicate_with_select(u
__locals__((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyuPopen�sV
	{			
"		9			P	
		(				-	
	�			!	B	>		cCswtdgdt�j�d}td�t|�tj�dkrjtdgdd��}|j�ntd�td	gdt�}td
dgd|jdt�}tt|j�d��t�td
�yttdg�j��Wnkt	k
r_}zK|j
t
jkr=td�td�t|j�ntd|j
�WYdd}~XnXtddt
j�dS(Nupsustdoutiu
Process list:uidu
preexec_fncSs
tjd�S(Nid(uosusetuid(((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu<lambda>qsuLooking for 'hda'...udmesgugrepuhdaustdinuTrying a weird file...u/this/path/does/not/existu'The file didn't exist.  I thought so...uChild traceback:uErroruGosh.  No error.ufile(uPopenuPIPEucommunicateuprintuosugetuiduwaitustdouturepruOSErroruerrnouENOENTuchild_tracebackusysustderr(uplistupup1up2ue((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu_demo_posixes*



!


#cCs{td�tddtdd
�}tdd|jdt�}tt|j�d��td�td	�}|j�dS(Nu%Looking for 'PROMPT' in set output...usetustdoutushellu
find "PROMPT"ustdiniuExecuting calc...ucalcT(uprintuPopenuPIPEuTrueustdoutureprucommunicateuwait(up1up2up((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu
_demo_windows�s

u__main__(@u__doc__usysuplatformu	mswindowsuiouosu	tracebackugcusignalubuiltinsuwarningsuerrnou	ExceptionuCalledProcessErroru	threadingumsvcrtu_subprocessuSTARTUPINFOu
pywintypesuselectuhasattru	_has_pollufcntlupickleu_posixsubprocessuImportErroruNoneuwarnuRuntimeWarningugetattru	_PIPE_BUFu_FD_CLOEXECu_set_cloexecucloexec_pipeu_create_pipeu__all__uCREATE_NEW_CONSOLEuCREATE_NEW_PROCESS_GROUPuSTD_INPUT_HANDLEuSTD_OUTPUT_HANDLEuSTD_ERROR_HANDLEuSW_HIDEuSTARTF_USESTDHANDLESuSTARTF_USESHOWWINDOWuextendusysconfuMAXFDu_activeu_cleanupuPIPEuSTDOUTu_eintr_retry_callucallu
check_callucheck_outputulist2cmdlineugetstatusoutputu	getoutputuobjectu_PLATFORM_DEFAULT_CLOSE_FDSuPopenu_demo_posixu
_demo_windowsu__name__(((u1/usr/local/python-3.2/lib/python3.2/subprocess.pyu<module>Os�
			:		
			!	J		
	����	)	

© 2025 GrazzMean