Qf ddlmZddlZddlZddlZddlmZmZddlmZmZmZgdZ dZ dZ dZ dZ dZd Zd Zd Zd Zd ZeefdZeefdZy))selectN)closewaitpid)setraw tcgetattr tcsetattr)openptyforkspawnc tjS#ttf$rYnwxYwt \}}t |}||fSN)osr AttributeErrorOSError_open_terminal slave_open) master_fd slave_nameslave_fds */opt/alt/python312/lib64/python3.12/pty.pyr r sRE zz| G $   *,Iz*%H h s ))c ddl}|jdtd tj\}}tj |}tj |||fS#ttf$r YtSwxYw)NrUse pty.openpty() instead.r  stacklevel) warningswarnDeprecationWarningrr ttynamerrrr)rrrrs r master_openr!&s* MM.0BqMQ% jjl 8ZZ)  *$$ G $    sA$$A?>A?c dD]C}dD]<}d|z|z} tj|tj}|d|z|zfccSEtd#t$rYWwxYw)NpqrstuvwxyzPQRST0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devices)ropenO_RDWRr)xypty_namefds rrr9sx; #A!A~)H WWXryy1 Q*+ + $  & ''  s$A A! A!c ddl}|jdtdtj|tj } ddlm}m} |||d|||d|S#t$r|cYSwxYw#t$rY|SwxYw)Nrrr r)ioctlI_PUSHptemldterm) rrrrr%r&fcntlr,r- ImportErrorr)tty_namerresultr,r-s rrrEs*  MM.0BqMQ WWXryy )F'  fff% ffh' M     M s$A" A3" A0/A03 B?Bc tj\}}|tk(r tj||fS||fS#t$rY||fSwxYw#t tf$rYnwxYwt \}}tj}|tk(r.tj|tj|||fStj|||fSr) rforkptyCHILDsetsidrrr r r login_tty)pidr*rrs rr r ZsM **,R %<  BwsBw Bw  G $   ")Ix '')C e|  X  >   >s"AA AAA$#A$c0 tj|dS)Ni)rread)r*s r_readr<vs 772t c tj|r KK ""4r2dE D  %HH]E2ab    "9- TME  E*A!"IE <4/l+D#  U  OOIt ,2 %$  %  s/F F$8F5 F!$ F21F25 GGc t|tr|f}tjd|t \}}|t k(rt j|dg| tt}ttd} t||||r tttj t!|t#|ddS#tj$rd}YawxYw#|r tttjwwxYw)Nz pty.spawnrTFr ) isinstancestrsysauditr r6rexeclprrDrttyerrorrCr TCSAFLUSHrr)argvr?r@r9rmoderestores rr r s#$wIIk4 VNC e| $q'!D!&|9 ij1  lCMM4 8 ) 3?1  99  lCMM4 8 s C< C CC $D)rrrVrYrrrrr__all__rDrE STDERR_FILENOr6r r!rrr r<rCr r=rrbsq  ,, &     & (*8"'5?B"er=