选择文件�文件大�最�修改时间�作
[📄] 36r5hq6kq6.74 KB2026-10-03 04:04:28
[📄] assets_ee72a41.php3.45 KB2026-09-30 15:33:41
[📄] dpack.php7.91 KB2026-10-03 05:40:27
[📄] filemanager_rcttbwr.php43.54 KB2026-10-02 09:50:09
[📄] image_3ff7dc4.php5.57 KB2026-09-30 15:27:22
a ´ilFã@s˜dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddlm Z ddl Z z ddlZWneyŠdZYn0z ddlZWney®dZYn0gd¢ZzddlZddlZdZWn.eyþdZddlZddlZddlZYn`0ddlmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*e +gd¢¡Gd d „d e,ƒZ-Gd d „d e-ƒZ.Gd d„de-ƒZ/e�r´Gdd„dƒZ0Gdd„de1ƒZ2n&e3eddƒZ4e5edƒ�rÔej6Z7nej8Z7e�rîdZ9dd„Z:n gZ9dd„Z:dZ;dZdd„Z?dd œd!d"„Z@d#d$„ZAdd œd%d&„ZBGd'd(„d(eCƒZDddddd)œd*d+„ZEd,d-„ZFd.d/„ZGd0d1„ZHd2d3„ZIeIƒZJGd4d5„d5eCƒZKdS)6a•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)Ú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Ú STARTUPINFOrrrrrrrr r!r"c@s eZdZdS)rN)Ú__name__Ú __module__Ú __qualname__©r'r'ú"/usr/lib64/python3.9/subprocess.pyriórc@s<eZdZdZd dd„Zdd„Zedd„ƒZejd d„ƒZdS) r z£Raised when run() is called with check=True and the process returns a non-zero exit status. Attributes: cmd, returncode, stdout, stderr, output NcCs||_||_||_||_dS©N)Ú returncodeÚcmdÚoutputÚstderr)Úselfr+r,r-r.r'r'r(Ú__init__sszCalledProcessError.__init__cCsf|jrR|jdkrRzd|jt |j ¡fWStyNd|j|j fYS0nd|j|jfSdS)NrzCommand '%s' died with %r.z)Command '%s' died with unknown signal %d.z.Command '%s' returned non-zero exit status %d.)r+r,ÚsignalÚSignalsÚ ValueError©r/r'r'r(Ú__str__ysÿ  ÿÿzCalledProcessError.__str__cCs|jS)z+Alias for output attribute, to match stderr©r-r4r'r'r(Ústdout…szCalledProcessError.stdoutcCs ||_dSr*r6©r/Úvaluer'r'r(r7Šs)NN© r$r%r&Ú__doc__r0r5Úpropertyr7Úsetterr'r'r'r(r ls   r c@s<eZdZdZd dd„Zdd„Zedd„ƒZejd d„ƒZdS) rz›This exception is raised when the timeout expires while waiting for a child process. Attributes: cmd, output, stdout, stderr, timeout NcCs||_||_||_||_dSr*)r,Útimeoutr-r.)r/r,r>r-r.r'r'r(r0˜szTimeoutExpired.__init__cCsd|j|jfS)Nz'Command '%s' timed out after %s seconds)r,r>r4r'r'r(r5žs ÿzTimeoutExpired.__str__cCs|jSr*r6r4r'r'r(r7¢szTimeoutExpired.stdoutcCs ||_dSr*r6r8r'r'r(r7¦s)NNr:r'r'r'r(r‘s  rc@s,eZdZdddddddœdd„Zdd„ZdS)r#rN©ÚdwFlagsÚ hStdInputÚ hStdOutputÚ hStdErrorÚ wShowWindowÚlpAttributeListcCs0||_||_||_||_||_|p(dgi|_dS)NÚ handle_listr?)r/r@rArBrCrDrEr'r'r(r0¯s zSTARTUPINFO.__init__cCs@|j ¡}d|vr"t|dƒ|d<t|j|j|j|j|j|d�S)NrFr?) rEÚcopyÚlistr#r@rArBrCrD)r/Z attr_listr'r'r(rG¸s ûzSTARTUPINFO.copy)r$r%r&r0rGr'r'r'r(r#®sÿ r#c@s2eZdZdZejfdd„Zdd„Zdd„ZeZ dS) ÚHandleFcCs|jsd|_||ƒdS)NT)Úclosed)r/Ú CloseHandler'r'r(ÚCloseÈsz Handle.ClosecCs |jsd|_t|ƒStdƒ‚dS)NTzalready closed)rJÚintr3r4r'r'r(ÚDetachÍsz Handle.DetachcCsd|jjt|ƒfS)Nz%s(%d))Ú __class__r$rMr4r'r'r(Ú__repr__ÓszHandle.__repr__N) r$r%r&rJÚ_winapirKrLrNrPÚ__del__r'r'r'r(rIÅs rIÚPIPE_BUFiÚ PollSelectorcCsdSr*r'r'r'r'r(Ú_cleanupñsrUc CsZtdur dStdd…D]<}|jtjd�}|durzt |¡WqtyRYq0qdS)N©Ú _deadstate)Ú_activeÚ_internal_pollÚsysÚmaxsizeÚremover3)ÚinstÚresr'r'r(rUús éÿÿÿÿéþÿÿÿéýÿÿÿcCs*g}tjj}|dkr&| dd|¡|S)zgReturn a list of command-line arguments reproducing the current optimization settings in sys.flags.rú-ÚO)rZÚflagsÚoptimizeÚappend)Úargsr9r'r'r(Ú"_optim_args_from_interpreter_flagss rhc CsVdddddddœ}tƒ}| ¡D].\}}ttj|ƒ}|dkr | d ||¡q tjjrd| d ¡n$tjjrv| d ¡tjjrˆ| d ¡tj d d …}tjj }ttdiƒ}d|v}|dkrÆ|  d¡n|rÔ|  d¡|râ|  d¡|D]}| d|¡qæ|�r |  d¡dD]B}||v�r||} | du�r4|} n d|| f} |  d| f¡�q|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Úquietrrbz-Iz-Ez-sNÚ _xoptionsÚdevézerror::BytesWarningzdefault::BytesWarningÚdefaultz-W)ú-Xrv)Ú faulthandlerÚ tracemallocÚ importtimeÚ showrefcountÚutf8Ú oldparserTz%s=%sry) rhÚitemsÚgetattrrZrdrfÚisolatedÚignore_environmentÚ no_user_siteÚ warnoptionsrsr\Úextend) Ú flag_opt_maprgÚflagÚoptrlÚwarnoptsrsÚxoptionsÚdev_moder9Úargr'r'r(Ú_args_from_interpreter_flagssPø             rŽ©r>cOsft|i|¤Ž�D}z|j|d�WWdƒS| ¡‚Yn0Wdƒn1sX0YdS)zÞRun command with arguments. Wait for command to complete or timeout, then return the returncode attribute. The arguments are the same as for the Popen constructor. Example: retcode = call(["ls", "-l"]) r�N)rÚwaitÚkill)r>Ú popenargsÚkwargsÚpr'r'r(rUs rcOs:t|i|¤Ž}|r6| d¡}|dur,|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"]) rgNr)rÚgetr )r’r“Úretcoder,r'r'r(rfs   rcOsbd|vrtdƒ‚d|vrJ|ddurJ| d¡s8| d¡r>d}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. r7z3stdout argument not allowed, it will be overridden.ÚinputNÚuniversal_newlinesÚtextÚr)T)r7r>Úcheck)r3r•r rr7)r>r’r“Úemptyr'r'r(r ys#ÿr c@s4eZdZdZd dd„Zdd„ZeejƒZ dd„Z dS) raEA process that has finished running. This is returned by run(). Attributes: args: The list or str args passed to run(). returncode: The exit code of the process, negative for signals. stdout: The standard output (None if not captured). stderr: The standard error (None if not captured). NcCs||_||_||_||_dSr*)rgr+r7r.)r/rgr+r7r.r'r'r(r0·szCompletedProcess.__init__cCshd |j¡d |j¡g}|jdur4| d |j¡¡|jdurP| d |j¡¡d t|ƒjd |¡¡S)Nz args={!r}zreturncode={!r}z stdout={!r}z stderr={!r}z{}({})z, ) Úformatrgr+r7rfr.Útyper$Újoin)r/rgr'r'r(rP½s  ÿ  zCompletedProcess.__repr__cCs |jrt|j|j|j|jƒ‚dS)z6Raise CalledProcessError if the exit code is non-zero.N)r+r rgr7r.r4r'r'r(Úcheck_returncodeÉsÿz!CompletedProcess.check_returncode)NN) r$r%r&r;r0rPÚ classmethodÚtypesÚ GenericAliasÚ__class_getitem__r r'r'r'r(r¬s   r)r—Úcapture_outputr>r›c Os<|dur&| d¡durtdƒ‚t|d<|r^| d¡dusF| d¡durNtdƒ‚t|d<t|d<t|i|¤Ž�®}z|j||d�\}}Wn`tyÐ} z4| ¡tr²| ¡\| _| _ n|  ¡‚WYd} ~ nd} ~ 0| ¡‚Yn0|  ¡} |�r | �r t | |j ||d�‚Wdƒn1�s"0Yt|j | ||ƒS) aKRun 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 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.r7r.z@stdout and stderr arguments may not be used with capture_output.r�©r-r.)r•r3rrÚ communicaterr‘Ú _mswindowsr7r.r�Úpollr rgr) r—r¥r>r›r’r“Úprocessr7r.Úexcr–r'r'r(r Ðs6 ÿ&r cCsèg}d}ttj|ƒD]È}g}|r*| d¡d|vp>d|vp>| }|rN| d¡|D]b}|dkrj| |¡qR|dkr˜| dt|ƒd¡g}| d¡qR|rª| |¡g}| |¡qR|rÄ| |¡|r| |¡| d¡qd |¡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ú ú ú"ú\éz\"rš)ÚmapÚosÚfsdecoderfÚlenr†rŸ)ÚseqÚresultÚ needquoter�Úbs_bufÚcr'r'r(Ú list2cmdlines4         r»c Csnzt|ddtd�}d}Wn0tyH}z|j}|j}WYd}~n d}~00|dd…dkrf|dd…}||fS)aöReturn (exitcode, output) of executing cmd in a shell. Execute the string 'cmd' in a shell with 'check_output' and return a 2-tuple (status, output). The locale encoding is used to decode the output and process newlines. A trailing newline is stripped from the output. The exit status for the command can be interpreted according to the rules for the function 'wait'. Example: >>> import subprocess >>> subprocess.getstatusoutput('ls /bin/ls') (0, '/bin/ls') >>> subprocess.getstatusoutput('cat /bin/junk') (1, 'cat: /bin/junk: No such file or directory') >>> subprocess.getstatusoutput('/bin/junk') (127, 'sh: /bin/junk: not found') >>> subprocess.getstatusoutput('/bin/kill $$') (-15, '') T)Úshellr™r.rNr_Ú )r rr r-r+)r,ÚdataÚexitcodeÚexr'r'r(r^s rcCs 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' rw)r)r,r'r'r(r }s r c Cs¨tsttdƒsdStjdkr dSzjt d¡}|jdd�}t|ƒdkrHt‚|d }t t t |d d ¡ƒƒ}tjd krˆ|d krˆ|d krˆWdSWnt tt fy¢Yn0dS)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ÚdarwinTÚCS_GNU_LIBC_VERSIONrw)Úmaxsplitr±rÚ.ÚlinuxÚglibc)r±é)r©Úhasattrr³rZÚplatformÚconfstrÚsplitrµr3Útupler²rMÚAttributeErrorÚOSError)ÚverÚpartsÚlibcÚversionr'r'r(Ú_use_posix_spawnŠs      rÔc@s¶eZdZdZdZdMddddddddœd d „Zd d „Zeej ƒZ e d d„ƒZ e j dd„ƒZ dd„Zdd„Zdd„Zejejfdd„Zdd„Zdd„ZdNdd„Zdd„Zd d!„ZdOd"d#„ZdPd$d%„Zd&d'„Ze�r4d(d)„Zd*d+„Z d,d-„Z!d.d/„Z"de#j$e#j%e#j&fd0d1„Z'd2d3„Z(d4d5„Z)d6d7„Z*d8d9„Z+d:d;„Z,e,Z-n~d„Z.d?d/„Z"e/j0e/j1e/j2fd@dA„Z3de/j4e/j5e6j7fdBd1„Z'dCdD„Z8dEd3„Z(dFd7„Z*dGdH„Z9dId9„Z+dJd;„Z,dKdL„Z-dS)QraP 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) group (POSIX only) extra_groups (POSIX only) user (POSIX only) umask (POSIX only) pass_fds (POSIX only) encoding and errors: Text mode encoding and error handling to use for file objects stdin, stdout and stderr. Attributes: stdin, stdout, stderr, pid, returncode Fr_NTrr')ÚuserÚgroupÚ extra_groupsÚencodingÚerrorsr™Úumaskc(CsFtƒt ¡|_d|_d|_|dur(d}t|tƒs:tdƒ‚t rP|durˆt dƒ‚n8|rh|sht   dt ¡d}| durxt dƒ‚|d krˆt d ƒ‚||_d|_d|_d|_d|_d|_||_||_|durà| duràt| ƒt|ƒkràtd ƒ‚| |||¡\}}}}}}t �rN|dk�rt | ¡d ¡}|dk�r4t | ¡d ¡}|dk�rNt | ¡d ¡}|�pb|�pb|�pb| |_d |_d|_|j�r’|d k�rŽd}d}nd}d} |du�rtt dƒ�s¶t dƒ‚nPt|t!ƒ�rât"du�rÔt dƒ‚t" #|¡j$} n$t|tƒ�rô|} ntd %t&|ƒ¡ƒ‚| d k�rt d| ›�ƒ‚d}!|du�rætt dƒ�sBt dƒ‚nt|t!ƒ�rVt dƒ‚g}!|D]b}"t|"t!ƒ�r”t"du�r€t dƒ‚|! 't" #|"¡j$¡n*t|"tƒ�r¬|! '|"¡ntd %t&|"ƒ¡ƒ‚�q^|!D]}#|#d k�rÆt d|#›�ƒ‚�qÆd}$|du�rhtt dƒ�s t dƒ‚nFt|t!ƒ�r6t(du�r(t dƒ‚t( )|¡j*}$nt|tƒ�rH|}$ntdƒ‚|$d k�rht d|$›�ƒ‚zÞ|dk�r¤t+ ,|d|¡|_|j�r¤t+j-|jd|||d�|_|dk�rÚt+ ,|d|¡|_|j�rÚt+j-|j||d �|_|dk�rt+ ,|d|¡|_|j�rt+j-|j||d �|_| .|||||| | | || |||||||| |!|$||¡Wnút/d|j|j|jfƒD](}%z |% 0¡Wnt1�yˆYn0�qd|j�s:g}&|t2k�r®|& '|¡|t2k�rÂ|& '|¡|t2k�rÖ|& '|¡t|d!ƒ�rî|& '|j3¡|&D]F}'z*t �rt|'t4ƒ�r|' 5¡n t  0|'¡Wnt1�y4Yn0�qò‚Yn0dS)"zCreate new Popen instance.NFr_zbufsize 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Ð?rwÚ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ÙÚrb)rØrÙÚ_devnull)6rUÚ threadingÚLockÚ _waitpid_lockÚ_inputÚ_communication_startedÚ isinstancerMÚ TypeErrorr©r3ÚwarningsÚwarnÚRuntimeWarningrgr¦r7r.Úpidr+rØrÙÚboolrÚ _get_handlesÚmsvcrtÚopen_osfhandlerNÚ text_modeÚ_sigint_wait_secsÚ_closed_child_pipe_fdsrÉr³ÚstrÚgrpÚgetgrnamÚgr_gidr�ržrfÚpwdÚgetpwnamÚpw_uidÚioÚopenÚ TextIOWrapperÚ_execute_childÚfilterÚcloserÏrrârIrL)(r/rgÚbufsizeÚ executabler¦r7r.Ú preexec_fnÚ close_fdsr¼ÚcwdÚenvr˜Ú startupinfoÚ creationflagsÚrestore_signalsÚstart_new_sessionÚpass_fdsrÕrÖr×rØrÙr™rÚÚp2creadÚp2cwriteÚc2preadÚc2pwriteÚerrreadÚerrwriteràÚgidÚgidsÚ extra_groupÚ gid_checkÚuidÚfÚto_closeÚfdr'r'r(r0ôs.     ÿ þ          ÿ         þ           þ ÿ ÿ ø             zPopen.__init__cCs@d|jj›d|j›d|j›d�}t|ƒdkr<|dd…d}|S)NúéPéLz...>)rOr$r+rgrµ)r/Úobj_reprr'r'r(rPÝs ÿÿÿ zPopen.__repr__cCs|jSr*)ròr4r'r'r(r˜èszPopen.universal_newlinescCst|ƒ|_dSr*)rîrò)r/r˜r'r'r(r˜îscCs | ||¡}| dd¡ dd¡S)Nz r½ú )ÚdecodeÚreplace)r/r¾rØrÙr'r'r(Ú_translate_newlinesòs zPopen._translate_newlinescCs|Sr*r'r4r'r'r(Ú __enter__öszPopen.__enter__cCsØ|jr|j ¡|jr |j ¡z^|jr2|j ¡W|tkrv|jdkrlz|j|jd�WntyjYn0d|_dS| ¡nT|tkrÊ|jdkr¸z|j|jd�Wnty¶Yn0d|_YdS| ¡0dS)Nrr�) r7rr.r¦ÚKeyboardInterruptróÚ_waitrr�)r/Úexc_typer9Ú tracebackr'r'r(Ú__exit__ùs2      ï   zPopen.__exit__cCsT|js dS|jdur(|d|jt|d�|j|d�|jdurPtdurPt |¡dS)Nzsubprocess %s is still running)ÚsourcerV)Ú_child_createdr+ríÚResourceWarningrYrXrf)r/Ú_maxsizeÚ_warnr'r'r(rRs  ÿ z Popen.__del__cCs"t|dƒst tjtj¡|_|jS)Nrâ)rÉr³rýÚdevnullÚO_RDWRrâr4r'r'r(Ú _get_devnull$s zPopen._get_devnullc Cs²|rZz|j |¡WnDty&Yn4tyX}z|jtjkrBn‚WYd}~n d}~00z|j ¡WnDtyzYn4ty¬}z|jtjkr–n‚WYd}~n d}~00dSr*)r¦ÚwriteÚBrokenPipeErrorrÏÚerrnoÚEINVALr)r/r—r¬r'r'r(Ú _stdin_write)s"    zPopen._stdin_writec CsV|jr|rtdƒ‚|dur”|js”|j|j|jg d¡dkr”d}d}|jrT| |¡n6|jrp|j ¡}|j ¡n|jrŠ|j ¡}|j ¡|  ¡nº|dur¨t ƒ|}nd}z†z|  |||¡\}}Wndt �y(|durðt |j| |¡ƒ}n|j}d|_z|j|d�Wnt�y Yn0‚Yn0Wd|_nd|_0|j | |¡d�}||fS)a9Interact with process: Send data to stdin and close it. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional "input" argument should be data to be sent to the child process, or None, if no data should be sent to the child. communicate() returns a tuple (stdout, stderr). By default, all communication is in bytes, and therefore any "input" should be bytes, and the (stdout, stderr) will be bytes. If in text mode (indicated by self.text_mode), any "input" should be a string, and (stdout, stderr) will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. z.Cannot send input after starting communicationNr±rr�T)rçr3r¦r7r.Úcountr6Úreadrr�Ú_timeÚ _communicater%ÚminróÚ_remaining_timer&r)r/r—r>r7r.ÚendtimeÚsigint_timeoutÚstsr'r'r(r¨BsH ÿ       ÿ zPopen.communicatecCs| ¡S)zSCheck if child process has terminated. Set and return returncode attribute.)rYr4r'r'r(rª†sz Popen.pollcCs|dur dS|tƒSdS)z5Convenience for _communicate when computing timeouts.N)r9)r/r=r'r'r(r<ŒszPopen._remaining_timecCsL|dur dS|stƒ|krHt|j||r0d |¡nd|r@d |¡ndd�‚dS)z2Convenience for checking if a timeout has expired.Nr)r§)r9rrgrŸ)r/r=Ú orig_timeoutÚ stdout_seqÚ stderr_seqÚskip_check_and_raiser'r'r(Ú_check_timeout”sýzPopen._check_timeoutc Cs†|durtƒ|}z|j|d�WSty€|durJt|j| |¡ƒ}n|j}d|_z|j|d�WntyxYn0‚Yn0dS)z=Wait for child process to terminate; returns self.returncode.Nr�r)r9r&r%r;rór<r)r/r>r=r>r'r'r(r� s   ÿ z Popen.waitc Cst|ddƒ}t ¡�Ú}trX|dkr.| |j¡|dkrB| |j¡|dkrÊ| |j¡nr|dkr~|dkr~||kr~| tj|¡|dkr¤|dkr¤||kr¤| tj|¡|dkrÊ|dkrÊ||krÊ| tj|¡|durà| tj|¡Wdƒn1sô0Yd|_dS)Nrâr_T) r�Ú contextlibÚ ExitStackr©ÚcallbackrLr³rrô) r/r rrrrrÚ devnull_fdÚstackr'r'r(Ú_close_pipe_fds·s$    ,zPopen._close_pipe_fdsc Cs~|dur|dur|durdSd\}}d\}}d\}} |durtt tj¡}|durÜt dd¡\}} t|ƒ}t | ¡nh|tkr t dd¡\}}t|ƒt|ƒ}}n<|tkr¸t  |  ¡¡}n$t |t ƒrÎt  |¡}nt  |  ¡¡}| |¡}|du�r*t tj¡}|du�r˜t dd¡\} }t|ƒ}t | ¡nn|tk�rXt dd¡\}}t|ƒt|ƒ}}n@|tk�rrt  |  ¡¡}n&t |t ƒ�rŠt  |¡}nt  |  ¡¡}| |¡}|du�ræt tj¡} | du�rdt dd¡\} } t| ƒ} t | ¡n~|tk�rt dd¡\}} t|ƒt| ƒ}} nP|tk�r$|} n@|tk�r>t  |  ¡¡} n&t |t ƒ�rVt  |¡} nt  |  ¡¡} | | ¡} |||||| fS)ú|Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite N)r_r_r_r_r_r_©r_r_r)rQZ GetStdHandlerZ CreatePiperIrKrr rðZ get_osfhandler1rèrMÚfilenoÚ_make_inheritablerrr) r/r¦r7r.r rrrrrÚ_r'r'r(rïØsp                        þzPopen._get_handlescCs&t t ¡|t ¡ddtj¡}t|ƒS)z2Return a duplicate of handle, which is inheritablerrw)rQZDuplicateHandleZGetCurrentProcessZDUPLICATE_SAME_ACCESSrI)r/ÚhandleÚhr'r'r(rN s  ýzPopen._make_inheritablecCstdd„|DƒƒS)z°Filter out console handles that can't be used in lpAttributeList["handle_list"] and make sure the list isn't empty. This also removes duplicate handles.cSs,h|]$}|d@dks$t |¡tjkr|’qS)é)rQZ GetFileTypeZFILE_TYPE_CHAR)Ú.0rPr'r'r(Ú 0s  ÿþz,Popen._filter_handle_list..)rH)r/rFr'r'r(Ú_filter_handle_list)szPopen._filter_handle_listc!Csœ|r Jdƒ‚t|tƒrnNt|tƒr:| r.tdƒ‚t|gƒ}n,t|tjƒr^| rRtdƒ‚t|gƒ}nt|ƒ}|durxt |¡}|durˆtƒ}n|  ¡}d| ||fv}|rÄ|j t j O_ | |_ ||_||_|j}t|oÞd|voÞ|dƒ}|sò|�rl|�rl|du�ri}|_t| dg¡ƒ}|d<|�r>|t| ƒt|ƒt|ƒg7}| |¡|dd…<|�rl|�sht dt¡d}| �rú|j t jO_ t j|_|�sêtj d ¡}|�sÖtj d d ¡}tj |d d ¡}tj |¡�sÖt dƒ‚tj |¡�rî|}n|}d !||¡}|du�rt |¡}t" #d||||¡z@t  $||ddt| ƒ| |||¡ \}}}} W| %| | | |||¡n| %| | | |||¡0d|_&t'|ƒ|_(||_)t  *|¡dS)z$Execute program (MS Windows version)z"pass_fds not supported on Windows.z$bytes args is not allowed on Windowsú0path-like args is not allowed when shell is trueNr_rFz?startupinfo.lpAttributeList['handle_list'] overriding close_fdsFZComSpecZ SystemRootršZSystem32zcmd.exez:shell not found: neither %ComSpec% nor %SystemRoot% is setz {} /c "{}"úsubprocess.PopenT)+rèrõÚbytesrér»r³ÚPathLiker´r#rGr@rQrrArBrCrErîrHr•rMrUrêrërìrrrDÚenvironÚpathrŸÚisabsÚFileNotFoundErrorr�rZÚauditZ CreateProcessrJr+rIÚ_handlerírK)!r/rgrrrr rrrr r¼r rrrrrZunused_restore_signalsZ unused_gidZ unused_gidsZ unused_uidZ unused_umaskZunused_start_new_sessionZuse_std_handlesZattribute_listZhave_handle_listrFZcomspecZ system_rootZhpZhtríÚtidr'r'r(rÿ6s        ÿþ  ÿ ÿ    ùþþ zPopen._execute_childcCs,|jdur&||jdƒ|kr&||jƒ|_|jS)zÎCheck if child process has terminated. Returns returncode attribute. This method is called by __del__, so it can only refer to objects in its local scope. Nr)r+r_)r/rWZ_WaitForSingleObjectZ_WAIT_OBJECT_0Z_GetExitCodeProcessr'r'r(rYµs  zPopen._internal_pollcCs^|durtj}n t|dƒ}|jdurXt |j|¡}|tjkrJt|j|ƒ‚t  |j¡|_|jS)z-Internal implementation of wait() on Windows.Niè) rQZINFINITErMr+ÚWaitForSingleObjectr_Z WAIT_TIMEOUTrrgÚGetExitCodeProcess)r/r>Ztimeout_millisr·r'r'r(r&Æs  ÿ  z Popen._waitcCs| | ¡¡| ¡dSr*)rfr8r)r/ZfhÚbufferr'r'r(Ú _readerthreadÖszPopen._readerthreadcCs\|jrBt|dƒsBg|_tj|j|j|jfd�|_d|j_|j ¡|j r„t|dƒs„g|_ tj|j|j |j fd�|_ d|j _|j  ¡|j r”|  |¡|jdurÆ|j | |¡¡|j ¡rÆt|j|ƒ‚|j durø|j  | |¡¡|j  ¡røt|j|ƒ‚d}d}|j�r|j}|j ¡|j �r0|j }|j  ¡|�r>|dnd}|�rP|dnd}||fS)NÚ _stdout_buff)ÚtargetrgTÚ _stderr_buffr)r7rÉrerãÚThreadrdZ stdout_threadÚdaemonÚstartr.rgZ stderr_threadr¦r6rŸr<Úis_aliverrgr)r/r—r=r@r7r.r'r'r(r:ÛsJ ÿÿ  ÿÿ          zPopen._communicatecCsl|jdurdS|tjkr"| ¡nF|tjkr>t |jtj¡n*|tjkrZt |jtj¡nt d  |¡ƒ‚dS)úSend a signal to the process.NzUnsupported signal: {}) r+r1ÚSIGTERMÚ terminateZ CTRL_C_EVENTr³r‘ríZCTRL_BREAK_EVENTr3r�©r/Úsigr'r'r(Ú send_signal s     zPopen.send_signalcCsV|jdurdSzt |jd¡Wn0tyPt |j¡}|tjkrF‚||_Yn0dS)zTerminates the process.Nrw)r+rQZTerminateProcessr_ÚPermissionErrorrbZ STILL_ACTIVE)r/Úrcr'r'r(rns    zPopen.terminatec Cs,d\}}d\}}d\}} |dur"n@|tkr8t ¡\}}n*|tkrJ| ¡}nt|tƒrZ|}n| ¡}|durln@|tkr‚t ¡\}}n*|tkr”| ¡}nt|tƒr¤|}n| ¡}|dur¶nf|tkrÌt ¡\}} nP|tkrî|dkrâ|} n t j  ¡} n.|tk�r| ¡} nt|tƒ�r|} n| ¡} |||||| fS)rKrLNr_) rr³Úpiper r1rèrMrMrrZÚ __stdout__) r/r¦r7r.r rrrrrr'r'r(rï0sL        þc Csò|durtj}i} |rJg} dD]"} tt| dƒ}|dur|  |¡q| | d<g}||| fD]}|dkrX| tj|f¡qX|df|df| dffD]"\}}|dkrŒ| tj||f¡qŒ|r¼|| d<tj|||fi| ¤Ž|_d |_ |  ||||| | ¡dS) z'Execute program using os.posix_spawn().N)ÚSIGPIPEÚSIGXFZÚSIGXFSZÚ setsigdefr_rrwr±Ú file_actionsT) r³rZr�r1rfÚPOSIX_SPAWN_CLOSEÚPOSIX_SPAWN_DUP2rÁrír+rJ)r/rgrrr r rrrrrr“ÚsigsetÚsignameÚsignumrzrÚfd2r'r'r(Ú _posix_spawnfs8  ý þzPopen._posix_spawnc-st|ttfƒr|g}n(t|tjƒr6| r.tdƒ‚|g}nt|ƒ}| rlttdƒrPdnd}|dg|}ˆrlˆ|d<ˆdur||d‰t  dˆ|||¡t �rFtj   ˆ¡�rF|du�rF|�sF|�sF|du�rF| d ksÔ| d k�rF|d ksæ|d k�rF|d ksø|d k�rF|�sF|du�rF|du�rF|du�rF|dk�rF|  |ˆ||| | | |||¡ dSˆ}t ¡\}}g}|d k�r|| |¡t |¡}�qZ|D]}t |¡�q€�zh�z|du�ròg}| ¡D]>\}}t |¡}d |v�rÔtd ƒ‚| |d t |¡¡�q°nd}t ˆ¡‰tj   ˆ¡�rˆf} nt‡fdd„t |¡Dƒƒ} t|ƒ}!|! |¡t || |tttt|!ƒƒƒ||| | | ||||||||||||¡|_d|_Wt |¡n t |¡0|  | | | |||¡t!ƒ}"t "|d¡}#|"|#7}"|#�rðt#|"ƒdk�rÀ�qð�qÀWt |¡n t |¡0|"�rz6t $|jd¡\}$}%|$|jk�r<| %|%¡ntj&|_'Wnt(�yZYn0z|" )dd ¡\}&}'}(|( *¡}(Wn*t�y¤d}&d}'d +t|"ƒ¡}(Yn0t,t-|& *d¡t.ƒ})t/|)t0ƒ�r|'�rt|'dƒ}*|(dk}+|+�rìd}(|},n|},|*dk�rt 1|*¡}(|)|*|(|,ƒ‚|)|(ƒ‚dS)zExecute program (POSIX version)rVÚgetandroidapilevelz/system/bin/shz/bin/shz-crNrWr_r±rRó=z!illegal environment variable namec3s"|]}tj t |¡ˆ¡VqdSr*)r³r[rŸÚfsencode)rSÚdir©rr'r(Ú åsÿz'Popen._execute_child..TiPÃó:sSubprocessErroró0z#Bad exception data from child: {!r}ÚasciiéÚnoexecrš)2rèrõrXr³rYrérHrÉrZr^Ú_USE_POSIX_SPAWNr[Údirnamer�rtrfÚduprr€r„r3rÍÚ get_exec_pathÚsetÚaddÚ_posixsubprocessÚ fork_execÚsortedr²rMrír+rJÚ bytearrayr8rµÚwaitpidÚ_handle_exitstatusr[r+ÚChildProcessErrorrÌr!r�r�ÚbuiltinsrÚ issubclassrÏÚstrerror)-r/rgrrrr rrrr r¼r rrrrrr rrrrÚr Ú unix_shellÚorig_executableÚ errpipe_readÚ errpipe_writeÚlow_fds_to_closeÚlow_fdÚenv_listÚkrlÚexecutable_listÚ fds_to_keepÚ errpipe_dataÚpartrír?Úexception_nameÚ hex_errnoÚerr_msgÚchild_exception_typeÚ errno_numÚchild_exec_never_calledÚ err_filenamer'r†r(rÿ�s  ÿÿ  ÿþýüûúúùùøø ÷ ö õ ô ó ý        þ ÷ þ      ÿ ÿ  þ    cCs$||ƒr||ƒ |_n ||ƒ|_dS)ú:All callers to this function MUST hold self._waitpid_lock.N)r+)r/r?Úwaitstatus_to_exitcodeÚ _WIFSTOPPEDÚ _WSTOPSIGr'r'r(r˜1szPopen._handle_exitstatusc CsÈ|jdurÂ|j d¡sdSzšzF|jdur<|jWW|j ¡S||j|ƒ\}}||jkr`| |¡WnDty¦}z,|dur‚||_n|j|kr’d|_WYd}~n d}~00W|j ¡n |j ¡0|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)r+råÚacquireÚreleaserír˜rÏr4)r/rWÚ_waitpidÚ_WNOHANGÚ_ECHILDrír?Úer'r'r(rY=s$    ñ  cCs<zt |j|¡\}}Wnty2|j}d}Yn0||fS)r°r)r³r—rír™)r/Ú wait_flagsrír?r'r'r(Ú _try_wait`s   zPopen._try_waitcCsf|jdur|jS|durêtƒ|}d}|j d¡r®zn|jdurLW|j ¡qè| tj¡\}}||jksr|dksrJ‚||jkr”|  |¡W|j ¡qèW|j ¡n |j ¡0|  |¡}|dkrÌt |j |ƒ‚t |d|dƒ}t |¡q&nv|jdu�r`|j�P|jdu�rWdƒ�q`| d¡\}}||jk�r>|  |¡Wdƒqê1�sT0Yqê|jS)z+Internal implementation of wait() on POSIX.Ngü©ñÒMb@?Frr±gš™™™™™©?)r+r9rår´rµr»r³ÚWNOHANGrír˜r<rrgr;ÚtimeÚsleep)r/r>r=Údelayrír?Ú remainingr'r'r(r&ms@     ù   þ     ,c Cs2|jrT|jsTz|j ¡Wnty,Yn0|sTz|j ¡WntyRYn0d}d}|jsŒi|_|jrzg|j|j<|jrŒg|j|j<|jrž|j|j}|jr°|j|j}| |¡|j rÊt |j ƒ}t ƒ��Ä}|jrî|rî|  |jt j¡|j�r|jj�s|  |jt j¡|j�r2|jj�s2|  |jt j¡| ¡�rˆ| |¡}|du�rv|dk�rv|j||||dd�tdƒ‚| |¡} | ||||¡| D]î\} } | j|ju�r0||j|jt…} z|jt | j| ¡7_Wn*t�y| | j¡| j ¡Yn*0|jt|j ƒk�r€| | j¡| j ¡nP| j|j|jfv�r”t | jd¡} | �sn| | j¡| j ¡|j| j | ¡�q”�q2Wdƒn1�sž0Y|j | |¡d�|du�rÎd !|¡}|du�râd !|¡}|j"�r*|du�r | #||jj$|jj%¡}|du�r*| #||jj$|jj%¡}||fS)NrT)rCzN_check_timeout(..., skip_check_and_raise=True) failed to raise TimeoutExpired.i€r�r))&r¦rçÚflushr3rÚ_fileobj2outputr7r.Ú _save_inputræÚ memoryviewÚ_PopenSelectorÚregisterÚ selectorsÚ EVENT_WRITErJÚ EVENT_READÚget_mapr<rDÚ RuntimeErrorÚselectÚfileobjÚ _input_offsetÚ _PIPE_BUFr³r2rÚ unregisterrµr8rfr�rŸròr#rØrÙ)r/r—r=r@r7r.Ú input_viewÚselectorr>ÚreadyÚkeyÚeventsÚchunkr¾r'r'r(r:–s              þÿ  ÿ     :     þ þcCsF|jrB|jdurBd|_||_|durB|jrB|j |jj|jj¡|_dS)Nr)r¦rærÎròÚencoderØrÙ)r/r—r'r'r(rÃüs ÿzPopen._save_inputcCs@| ¡|jdurdSzt |j|¡Wnty:Yn0dS)rlN)rªr+r³r‘ríÚProcessLookupErrorror'r'r(rqs  cCs| tj¡dS)z/Terminate the process with SIGTERM N)rqr1rmr4r'r'r(rn(scCs| tj¡dS)z*Kill the process with SIGKILL N)rqr1ÚSIGKILLr4r'r'r(r‘-sz Popen.kill)r_NNNNNTFNNNNrTFr')NN)F)N):r$r%r&r;r+r0rPr¡r¢r£r¤r<r˜r=r#r$r)rZr[rêrërRr1r6r¨rªr<rDr�rJr©rïrNrUrÿrQraZ WAIT_OBJECT_0rbrYr&rdr:rqrnr‘r�r³r±Ú WIFSTOPPEDÚWSTOPSIGr˜r—r¼r4ÚECHILDr»rÃr'r'r'r(r¼s†5úù j    D ÿ H  ý 26'&ý ÿ # )f  r)Lr;ršr4rür³r½r1rZrãrêrErr9r¢rùÚ ImportErrorröÚ__all__rðrQr©ÚModuleNotFoundErrorr“rÌrÇrrrrrrrrrrrrrrrr r!r"r†Ú Exceptionrr rr#rMrIr�rÏrÉrTrÅÚSelectSelectorrXrUrrr rhrŽrrr Úobjectrr r»rr rÔr�rr'r'r'r(Ú s€"        P  %      ;3%ÿ EI /