PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  Ɵ[c@sddlZddlZddlZddlZddlZddlZddlZddlmZddl Z ddl m Z ddl m Z mZmZddlmZddlmZmZmZmZedZejd d kZd efd YZd ZdS(iN(tcontextmanager(tuse_native_pty_forki(tExceptionPexpecttEOFtTIMEOUT(t SpawnBase(twhichtsplit_command_linetselect_ignore_interruptstpoll_ignore_interruptsccs5y dVWn%tjk r0}t|jnXdS(s;Turn ptyprocess errors into our own ExceptionPexpect errorsN(t ptyprocesstPtyProcessErrorRtargs(te((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyt_wrap_ptyprocess_errs iitspawncBseZdZeZgddd'd'd'd'eed'd'dd'edZdZgd'd'dZ dZ edZ d Z d d Z d Zd Zdd dZdZdZdZddZdZdZdZdZedZejdZdZedZdZdZdZ d Z!d!Z"e#d"d'd'd#Z$d$Z%d%Z&d'd'd'd&Z'RS((sjThis is the main class interface for Pexpect. Use this class to start and control child applications. iitstrictc Cstt|jd|d|d|d|d| d| tj|_tj|_tj|_||_||_| |_ | |_ t j j jd|_|d krd |_d |_d|_n|j||| |||_d S( sThis is the constructor. The command parameter may be a string that includes a command and any arguments to the command. For example:: child = pexpect.spawn('/usr/bin/ftp') child = pexpect.spawn('/usr/bin/ssh user@example.com') child = pexpect.spawn('ls -latr /tmp') You may also construct it with a list of arguments like so:: child = pexpect.spawn('/usr/bin/ftp', []) child = pexpect.spawn('/usr/bin/ssh', ['user@example.com']) child = pexpect.spawn('ls', ['-latr', '/tmp']) After this the child application will be created and will be ready to talk to. For normal use, see expect() and send() and sendline(). Remember that Pexpect does NOT interpret shell meta characters such as redirect, pipe, or wild cards (``>``, ``|``, or ``*``). This is a common mistake. If you want to run a command and pipe it through another command then you must also start a shell. For example:: child = pexpect.spawn('/bin/bash -c "ls -l | grep LOG > logs.txt"') child.expect(pexpect.EOF) The second form of spawn (where you pass a list of arguments) is useful in situations where you wish to spawn a command and pass it its own argument list. This can make syntax more clear. For example, the following is equivalent to the previous example:: shell_cmd = 'ls -l | grep LOG > logs.txt' child = pexpect.spawn('/bin/bash', ['-c', shell_cmd]) child.expect(pexpect.EOF) The maxread attribute sets the read buffer size. This is maximum number of bytes that Pexpect will try to read from a TTY at one time. Setting the maxread size to 1 will turn off buffering. Setting the maxread value higher may help performance in cases where large amounts of output are read back from the child. This feature is useful in conjunction with searchwindowsize. When the keyword argument *searchwindowsize* is None (default), the full buffer is searched at each iteration of receiving incoming data. The default number of bytes scanned at each iteration is very large and may be reduced to collaterally reduce search cost. After :meth:`~.expect` returns, the full buffer attribute remains up to size *maxread* irrespective of *searchwindowsize* value. When the keyword argument ``timeout`` is specified as a number, (default: *30*), then :class:`TIMEOUT` will be raised after the value specified has elapsed, in seconds, for any of the :meth:`~.expect` family of method calls. When None, TIMEOUT will not be raised, and :meth:`~.expect` may block indefinitely until match. The logfile member turns on or off logging. All input and output will be copied to the given file object. Set logfile to None to stop logging. This is the default. Set logfile to sys.stdout to echo everything to standard output. The logfile is flushed after each write. Example log input and output to a file:: child = pexpect.spawn('some_command') fout = open('mylog.txt','wb') child.logfile = fout Example log to stdout:: # In Python 2: child = pexpect.spawn('some_command') child.logfile = sys.stdout # In Python 3, we'll use the ``encoding`` argument to decode data # from the subprocess and handle it as unicode: child = pexpect.spawn('some_command', encoding='utf-8') child.logfile = sys.stdout The logfile_read and logfile_send members can be used to separately log the input from the child and output sent to the child. Sometimes you don't want to see everything you write to the child. You only want to log what the child sends back. For example:: child = pexpect.spawn('some_command') child.logfile_read = sys.stdout You will need to pass an encoding to spawn in the above code if you are using Python 3. To separately log output sent to the child use logfile_send:: child.logfile_send = fout If ``ignore_sighup`` is True, the child process will ignore SIGHUP signals. The default is False from Pexpect 4.0, meaning that SIGHUP will be handled normally by the child. The delaybeforesend helps overcome a weird behavior that many users were experiencing. The typical problem was that a user would expect() a "Password:" prompt and then immediately call sendline() to send the password. The user would then see that their password was echoed back to them. Passwords don't normally echo. The problem is caused by the fact that most applications print out the "Password" prompt and then turn off stdin echo, but if you send your password before the application turned off echo, then you get your password echoed. Normally this wouldn't be a problem when interacting with a human at a real keyboard. If you introduce a slight delay just before writing then this seems to clear up the problem. This was such a common problem for many users that I decided that the default pexpect behavior should be to sleep just before writing to the child application. 1/20th of a second (50 ms) seems to be enough to clear up the problem. You can set delaybeforesend to None to return to the old behavior. Note that spawn is clever about finding commands on your path. It uses the same logic that "which" uses to find executables. If you wish to get the exit status of the child you must call the close() method. The exit or signal status of the child will be stored in self.exitstatus or self.signalstatus. If the child exited normally then exitstatus will store the exit return code and signalstatus will be None. If the child was terminated abnormally with a signal then signalstatus will store the signal value and exitstatus will be None:: child = pexpect.spawn('some_command') child.close() print(child.exitstatus, child.signalstatus) If you need more detail you can also read the self.status member which stores the status returned by os.waitpid. You can interpret this using os.WIFEXITED/os.WEXITSTATUS or os.WIFSIGNALED/os.TERMSIG. The echo attribute may be set to False to disable echoing of input. As a pseudo-terminal, all input echoed by the "keyboard" (send() or sendline()) will be repeated to output. For many cases, it is not desirable to have echo enabled, and it may be later disabled using setecho(False) followed by waitnoecho(). However, for some platforms such as Solaris, this is not possible, and should be disabled immediately on spawn. If preexec_fn is given, it will be called in the child process before launching the given command. This is useful to e.g. reset inherited signal handlers. The dimensions attribute specifies the size of the pseudo-terminal as seen by the subprocess, and is specified as a two-entry tuple (rows, columns). If this is unspecified, the defaults in ptyprocess will apply. The use_poll attribute enables using select.poll() over select.select() for socket handling. This is handy if your system could have > 1024 fds ttimeouttmaxreadtsearchwindowsizetlogfiletencodingt codec_errorstirixsN(tsuperRt__init__tptyt STDIN_FILENOt STDOUT_FILENOt STDERR_FILENOtcwdtenvtechot ignore_sighuptsystplatformtlowert startswitht_spawn__irix_hacktNonetcommandR tnamet_spawntuse_poll(tselfR(R RRRRRRR!R t preexec_fnRRt dimensionsR+((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyR$s $           cCsg}|jt||jdt|j|jd|jf|jd|jd|j|jrd|jdnd|jd|jf|jd|jf|jd t|j |jd t|j t |d r|jd t|j n|jd t|j |jdt|j|jdt|j|jdt|j|jdt|j|jdt|j|jdt|j|jdt|j|jdt|j|jdt|j|jdt|j|jdt|j|jdt|j|jdt|jdj|S(sVThis returns a human-readable string that represents the state of the object. s command: sargs: %rsbuffer (last 100 chars): %risbefore (last 100 chars): %rts after: %rs match: %rs match_index: s exitstatus: tptyprocs flag_eof: spid: s child_fd: sclosed: s timeout: s delimiter: s logfile: slogfile_read: slogfile_send: s maxread: s ignorecase: ssearchwindowsize: sdelaybeforesend: sdelayafterclose: sdelayafterterminate: s (tappendtreprtstrR(R tbuffertbeforetaftertmatcht match_indext exitstatusthasattrtflag_eoftpidtchild_fdtclosedRt delimiterRt logfile_readt logfile_sendRt ignorecaseRtdelaybeforesendtdelayafterclosetdelayafterterminatetjoin(R,ts((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyt__str__s6'c sWt|tdr0tddddnt|tgsTtdn|gkrt||_|jd|_n&||_|jjd|||_t|jd|j }|dkrtdd |jn||_|j|jdsThe pid member must be None.s$The command member must not be None.R R-cs0tjtjtjdk r,ndS(s7Set SIGHUP to be ignored, then call the real preexec_fnN(tsignaltSIGHUPtSIG_IGNR'((R-(s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pytpreexec_wrappers R.RN(t isinstancettypeRt TypeErrorRR R(tinsertRRR'RFR)R<tAssertionErrorR R!Rtbytestencodet _spawnptyRR0tfdR=tFalset terminatedR>( R,R(R R-R.tcommand_with_pathtkwargsROta((R-s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyR*sH           @ cKstjj||S(s1Spawn a pty and return an instance of PtyProcess.(R t PtyProcessR(R,R R\((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyRW8scCsM|jt|jjd|WdQX|jd|_t|_dS(s?This closes the connection with the child application. Note that calling close() more than once is valid. This emulates standard Python behavior with files. Set force to True if you want to make sure that the child is terminated (SIGKILL is sent if the child ignores SIGHUP and SIGINT). tforceNi(tflushRR0tclosetisaliveR=tTrueR>(R,R_((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyRa<s     cCstj|jS(s^This returns True if the file descriptor is open and connected to a tty(-like) device, else False. On SVR4-style platforms implementing streams, such as SunOS and HP-UX, the child pty may not appear as a terminal device. This means methods such as setecho(), setwinsize(), getwinsize() may raise an IOError. (tostisattyR=(R,((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyReLs icCs|dkr|j}n|dk r7tj|}nxbtr|jsPtS|dkrl|dk rltS|dk r|tj}ntjdq:WdS(sThis waits until the terminal ECHO flag is set False. This returns True if the echo mode is off. This returns False if the ECHO flag was not set False before the timeout. This can be used to detect when the child is waiting for a password. Usually a child application will turn off echo mode when it is waiting for the user to enter a password. For example, instead of expecting the "password:" prompt you can wait for the child to set ECHO off:: p = pexpect.spawn('ssh user@example.com') p.waitnoecho() p.sendline(mypassword) If timeout==-1 then this method will use the value in self.timeout. If timeout==None then this method to block until ECHO flag is False. iig?N(RR'ttimeRctgetechoRYtsleep(R,Rtend_time((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyt waitnoechoWs      cCs |jjS(sThis returns the terminal echo mode. This returns True if echo is on or False if echo is off. Child applications that are expecting you to enter a password often set ECHO False. See waitnoecho(). Not supported on platforms where ``isatty()`` returns False. (R0Rg(R,((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyRguscCs|jj|S(sZThis sets the terminal echo mode on or off. Note that anything the child sent before the echo will be lost, so you should be sure that your input buffer is empty before you call setecho(). For example, the following will work as expected:: p = pexpect.spawn('cat') # Echo is on by default. p.sendline('1234') # We expect see this twice from the child... p.expect(['1234']) # ... once from the tty echo... p.expect(['1234']) # ... and again from cat itself. p.setecho(False) # Turn off tty echo p.sendline('abcd') # We will set this only once (echoed by cat). p.sendline('wxyz') # We will set this only once (echoed by cat) p.expect(['abcd']) p.expect(['wxyz']) The following WILL NOT WORK because the lines sent before the setecho will be lost:: p = pexpect.spawn('cat') p.sendline('1234') p.setecho(False) # Turn off tty echo p.sendline('abcd') # We will set this only once (echoed by cat). p.sendline('wxyz') # We will set this only once (echoed by cat) p.expect(['1234']) p.expect(['1234']) p.expect(['abcd']) p.expect(['wxyz']) Not supported on platforms where ``isatty()`` returns False. (R0tsetecho(R,tstate((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyRk}s icCs|jrtdn|dkr0|j}n|js|jr]t|jg|}n$t|jgggd\}}}|st|_ t dqn}|j r|jrt|jg|}n$t|jgggd\}}}| r|j rt|_ t dqn|jr@t|jg|}n$t|jggg|\}}}|s|jst|_ t dqt dn|j|krt t|j|Std d S( sCThis reads at most size characters from the child application. It includes a timeout. If the read does not complete within the timeout period then a TIMEOUT exception is raised. If the end of file is read then an EOF exception will be raised. If a logfile is specified, a copy is written to that log. If timeout is None then the read may block indefinitely. If timeout is -1 then the self.timeout value is used. If timeout is 0 then the child is polled and if there is no data immediately ready then this will raise a TIMEOUT exception. The timeout refers only to the amount of time to read at least one character. This is not affected by the 'size' parameter, so if you call read_nonblocking(size=100, timeout=30) and only one character is available right away then one character will be returned immediately. It will not wait for 30 seconds for another 99 characters to come in. This is a wrapper around os.read(). It uses select.select() to implement the timeout. sI/O operation on closed file.iis&End Of File (EOF). Braindead platform.is!End Of File (EOF). Slow platform.s&End of File (EOF). Very slow platform.sTimeout exceeded.sReached an unexpected state.N(R>t ValueErrorRRbR+R R=RRcR;RR&RRRtread_nonblockingR(R,tsizeRtrtwR ((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyRns<     $   $  !  cCs|j|dS(sHThis is similar to send() except that there is no return value. N(tsend(R,RG((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pytwritescCs"x|D]}|j|qWdS(sThis calls write() for each element in the sequence. The sequence can be any iterable object producing strings, typically a list of strings. This does not add line separators. There is no return value. N(Rs(R,tsequenceRG((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyt writeliness cCsl|jdk r"tj|jn|j|}|j|d|jj|dt}t j |j |S(sSends string ``s`` to the child process, returning the number of bytes written. If a logfile is specified, a copy is written to that log. The default terminal input mode is canonical processing unless set otherwise by the child process. This allows backspace and other line processing to be performed prior to transmitting to the receiving program. As this is buffered, there is a limited size of such buffer. On Linux systems, this is 4096 (defined by N_TTY_BUF_SIZE). All other systems honor the POSIX.1 definition PC_MAX_CANON -- 1024 on OSX, 256 on OpenSolaris, and 1920 on FreeBSD. This value may be discovered using fpathconf(3):: >>> from os import fpathconf >>> print(fpathconf(0, 'PC_MAX_CANON')) 256 On such a system, only 256 bytes may be received per line. Any subsequent bytes received will be discarded. BEL (``''``) is then sent to output if IMAXBEL (termios.h) is set by the tty driver. This is usually enabled by default. Linux does not honor this as an option -- it behaves as though it is always set on. Canonical input processing may be disabled altogether by executing a shell, then stty(1), before executing the final program:: >>> bash = pexpect.spawn('/bin/bash', echo=False) >>> bash.sendline('stty -icanon') >>> bash.sendline('base64') >>> bash.sendline('x' * 5000) RrtfinalN( RCR'RfRht_coerce_send_stringt_logt_encoderRVRYRdRsR=(R,RGtb((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyRrs #R/cCs#|j|}|j||jS(sWraps send(), sending string ``s`` to child process, with ``os.linesep`` automatically appended. Returns number of bytes written. Only a limited number of bytes may be sent for each line in the default terminal mode, see docstring of :meth:`send`. (RwRrtlinesep(R,RG((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pytsendline$scCs;|jdk r'|j|jd}n|j|ddS(s5Write control characters to the appropriate log filestreplaceRrN(RR'tdecodeRx(R,RG((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyt _log_control-scCs)|jj|\}}|j||S(sHelper method that wraps send() with mnemonic access for sending control character to the child (such as Ctrl-C or Ctrl-D). For example, to send Ctrl-G (ASCII 7, bell, ''):: child.sendcontrol('g') See also, sendintr() and sendeof(). (R0t sendcontrolR(R,tchartntbyte((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyR3s  cCs&|jj\}}|j|dS(s1This sends an EOF to the child. This sends a character which causes the pending parent output buffer to be sent to the waiting child program without waiting for end-of-line. If it is the first character of the line, the read() in the user program returns 0, which signifies end-of-file. This means to work as expected a sendeof() has to be called at the beginning of a line. This method does not send a newline. It is the responsibility of the caller to ensure the eof is sent at the beginning of a line. N(R0tsendeofR(R,RR((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyR@s cCs&|jj\}}|j|dS(snThis sends a SIGINT to the child. It does not require the SIGINT to be the first character on a line. N(R0tsendintrR(R,RR((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyRMscCs |jjS(N(R0R;(R,((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyR;TscCs||j_dS(N(R0R;(R,tvalue((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyR;XscCs|jS(s@This returns True if the EOF exception was ever raised. (R;(R,((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyteof\scCs!|jstSy|jtjtj|j|jsCtS|jtjtj|j|jsstS|jtj tj|j|jstS|r|jtj tj|j|jstSt Snt SWn5t k rtj|j|jstSt SnXdS(sThis forces a child process to terminate. It starts nicely with SIGHUP and SIGINT. If "force" is True then moves onto SIGKILL. This returns True if the child was terminated. This returns False if the child could not be terminated. N( RbRctkillRLRMRfRhREtSIGCONTtSIGINTtSIGKILLRYtOSError(R,R_((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyt terminateas6       cCsV|j}t|j}WdQX|j|_|j|_|j|_t|_|S(s@This waits until the child exits. This is a blocking call. This will not read any data from the child, so this will block forever if the child has unread output and has terminated. In other words, the child may have printed output then called exit(), but, the child is technically still alive until its output is read by the parent. This method is non-blocking if :meth:`wait` has already been called previously or :meth:`isalive` method returns False. It simply returns the previously determined exit status. N(R0RtwaittstatusR9t signalstatusRcRZ(R,R0R9((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyRs      cCs_|j}t|j}WdQX|s[|j|_|j|_|j|_t|_n|S(sZThis tests if the child process is running or not. This is non-blocking. If the child was terminated then this will read the exitstatus or signalstatus of the child. This returns True if the child process appears to be running or False if not. It can take literally SECONDS for Solaris to return the right status. N(R0RRbRR9RRcRZ(R,R0talive((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyRbs      cCs&|jr"tj|j|ndS(sThis sends the given signal to the child application. In keeping with UNIX tradition it has a misleading name. It does not necessarily kill the child unless you send the right signal. N(RbRdRR<(R,tsig((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyRs cCs |jjS(smThis returns the terminal window size of the child tty. The return value is a tuple of (rows, cols). (R0t getwinsize(R,((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyRscCs|jj||S(s=This sets the terminal window size of the child tty. This will cause a SIGWINCH signal to be sent to the child. This does not change the physical window size. It changes the size reported to TTY-aware applications like vi or curses -- applications that respond to the SIGWINCH signal. (R0t setwinsize(R,trowstcols((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyRsicCs|j|j|jj|j|_tj|j}tj |j|dk rrt rr|j d}nz|j |||Wdtj|jtj|XdS(sThis gives control of the child process to the interactive user (the human at the keyboard). Keystrokes are sent to the child process, and the stdout and stderr output of the child process is printed. This simply echos the child stdout and child stderr to the real stdout and it echos the real stdin to the child stdin. When the user types the escape_character this method will return None. The escape_character will not be transmitted. The default for escape_character is entered as ``Ctrl - ]``, the very same as BSD telnet. To prevent escaping, escape_character may be set to None. If a logfile is specified, then the data sent and received from the child process in interact mode is duplicated to the given log. You may pass in optional input and output filter functions. These functions should take a string and return a string. The output_filter will be passed all the output from the child process. The input_filter will be passed all the keyboard input from the user. The input_filter is run BEFORE the check for the escape_character. Note that if you change the window size of the parent the SIGWINCH signal will not be passed through to the child. If you want the child window size to change when the parent's window size changes then do something like the following example:: import pexpect, struct, fcntl, termios, signal, sys def sigwinch_passthrough (sig, data): s = struct.pack("HHHH", 0, 0, 0, 0) a = struct.unpack('hhhh', fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ , s)) if not p.closed: p.setwinsize(a[0],a[1]) # Note this 'p' is global and used in sigwinch_passthrough. p = pexpect.spawn('/bin/bash') signal.signal(signal.SIGWINCH, sigwinch_passthrough) p.interact() slatin-1N(twrite_to_stdoutR4tstdoutR`t buffer_typet_buffertttyt tcgetattrRtsetrawR'tPY3RVt_spawn__interact_copyt tcsetattrt TCSAFLUSH(R,tescape_charactert input_filtert output_filtertmode((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pytinteracts* cCs?x8|dkr:|jr:tj||}||}qWdS(s/This is used by the interact() method. R/N(RbRdRs(R,RXtdataR((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyt__interact_writenscCstj|dS(s/This is used by the interact() method. i(Rdtread(R,RX((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyt__interact_read sc Csx|jr|jr3t|j|jg}n't|j|jggg\}}}|j|kry|j|j}Wn0tk r}|jdt j krPnnX|dkrPn|r||}n|j |dt j |j|n|j|kr|j|j}|r3||}nd} |dk rW|j|} n| dkr|| }|r|j |dn|j|j|Pn|j |d|j|j|qqWdS(s/This is used by the interact() method. iR/RiRrN(RbR+R R=RRt_spawn__interact_readRR terrnotEIORxRdRsRR'trfindt_spawn__interact_writen( R,RRRRpRqR Rterrti((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyt__interact_copysB $    N((t__name__t __module__t__doc__RR'RYRcRRHR*RWRaReRjRgRkRnRsRuRrR|RRRRtpropertyR;tsetterRRRRbRRRtchrRRRR(((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyRsL     I     "J  ,    (    5  cOs|jddt||S(s-Deprecated: pass encoding to spawn() instead.Rsutf-8(t setdefaultR(R R\((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pytspawnu>s(RdR"RfRRRRLt contextlibRR tptyprocess.ptyprocessRt exceptionsRRRt spawnbaseRtutilsRRRR Rt version_infoRRR(((s2/tmp/pip-build-ViqJzN/pexpect/pexpect/pty_spawn.pyts&        "$