|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /proc/self/root/lib/python2.7/site-packages/ |
Upload File : |
�
��rGc @ s? d Z d d l Td d l Z d g Z d e f d � � YZ d S( s� This is like pexpect, but will work on any file descriptor that you pass it.
So you are reponsible for opening and close the file descriptor.
$Id: fdpexpect.py 505 2007-12-26 21:33:50Z noah $
i����( t *Nt fdspawnc B sV e Z d Z g d d d d d � Z d � Z d � Z d � Z e d � Z d � Z
RS(
s� This is like pexpect.spawn but allows you to supply your own open file
descriptor. For example, you could use it to read through a file looking
for patterns, or to control a modem or serial device. i i� c C s� t | � t d � k r6 t | d � r6 | j � } n t | � t d � k r] t d � � n y t j | � Wn t k
r� t d � n Xd | _ d | _ t
j | d | | | | | � | | _ t
| _ t
| _ d | | _ d S( s� This takes a file descriptor (an int) or an object that support the
fileno() method (returning an int). All Python file-like objects
support fileno(). i t filenosd The fd argument is not an int. If this is a command string then maybe you want to use pexpect.spawn.s/ The fd argument is not a valid file descriptor.s <file descriptor %d>N( t typet hasattrR t ExceptionPexpectt ost fstatt OSErrort Nonet argst commandt spawnt __init__t child_fdt Falset own_fdt closedt name( t selft fdR
t timeoutt maxreadt searchwindowsizet logfile( ( s- /usr/lib/python2.7/site-packages/fdpexpect.pyR
s '
c C s d S( N( ( R ( ( s- /usr/lib/python2.7/site-packages/fdpexpect.pyt __del__. s c C s\ | j d k r d S| j r, | j | � n, | j � t j | j � d | _ t | _ d S( Ni����( R R t closet flushR t TrueR ( R ( ( s- /usr/lib/python2.7/site-packages/fdpexpect.pyR 2 s
c C s: | j d k r t Sy t j | j � t SWn t SXd S( s� This checks if the file descriptor is still valid. If os.fstat()
does not raise an exception then we assume it is alive. i����N( R R R R R ( R ( ( s- /usr/lib/python2.7/site-packages/fdpexpect.pyt isalive>