Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325
 lŽŒY›ã@sÑdZddlmZddlZddlZdddgZdZdZdZdZd d„Z d d „Z d d „Z dd„Z dd„Z dd„Zdd„Zeedd„Zeedd„ZdS)zPseudo terminal utilities.é)ÚselectNÚopenptyÚforkÚspawnééc CsNytjƒSWnttfk r(YnXtƒ\}}t|ƒ}||fS)zdopenpty() -> (master_fd, slave_fd) Open a pty master/slave pair, using os.openpty() if possible.)ÚosrÚAttributeErrorÚOSErrorÚ_open_terminalÚ slave_open)Ú master_fdÚ slave_nameÚslave_fd©rú"/opt/python35/lib/python3.5/pty.pyrs c Cs^ytjƒ\}}Wnttfk r0Yn'Xtj|ƒ}tj|ƒ||fStƒS)z›master_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 ÚttynameÚcloser )r rrrrrÚ master_open!s  rc Cs€xmdD]e}x\dD]T}d||}ytj|tjƒ}Wntk rXwYnX|d||fSWqWtdƒ‚dS)z1Open pty master and return (master_fd, tty_name).ZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devicesN)rÚopenÚO_RDWRr )ÚxÚyZpty_nameÚfdrrrr 1s   r cCs…tj|tjƒ}yddlm}m}Wntk rG|SYnXy$|||dƒ|||dƒWntk r€YnX|S)z©slave_open(tty_name) -> slave_fd Open the pty slave and acquire the controlling terminal, returning opened filedescriptor. Deprecated, use openpty() instead.r)ÚioctlÚI_PUSHZptemZldterm)rrrZfcntlrrÚ ImportErrorr )Ztty_nameÚresultrrrrrr =s   r cCs6ytjƒ\}}Wnttfk r0Yn:X|tkr`ytjƒWntk r_YnX||fStƒ\}}tjƒ}|tkrtjƒtj|ƒtj |t ƒtj |t ƒtj |t ƒ|t krñtj|ƒtj tjt ƒtjƒ}tj|ƒn tj|ƒ||fS)zdfork() -> (pid, master_fd) Fork and make the child a session leader with a controlling terminal.)rÚforkptyr r ÚCHILDÚsetsidrrrÚdup2Ú STDIN_FILENOÚ STDOUT_FILENOÚ STDERR_FILENOrrr)Úpidrr rZtmp_fdrrrrOs0          cCs3x,|r.tj||ƒ}||d…}qWdS)z#Write all the data to a descriptor.N)rÚwrite)rÚdataÚnrrrÚ_writenws r)cCstj|dƒS)zDefault read function.i)rÚread)rrrrÚ_read}sr+cCs«|tg}x˜t|ggƒ\}}}||krh||ƒ}|sX|j|ƒntjt|ƒt|kr|tƒ}|s–|jtƒqt||ƒqWdS)z�Parent copy loop. Copies pty master -> standard output (master_read) standard input -> pty master (stdin_read)N)r"rÚremoverr&r#r))r Ú master_readÚ stdin_readÚfdsZrfdsZwfdsZxfdsr'rrrÚ_copy�s     r0cCsút|ƒtdƒkr!|f}tƒ\}}|tkrPtj|d|Œy&tjtƒ}tjtƒd}Wntj k r“d}YnXyt |||ƒWn.t k rØ|rÔtj ttj |ƒYnXtj|ƒtj|dƒdS)zCreate a spawned process.Úrr)ÚtyperrrÚexeclpÚttyZ tcgetattrr"ZsetrawÚerrorr0r Z tcsetattrZ TCSAFLUSHrÚwaitpid)Úargvr-r.r%r ÚmodeZrestorerrrr–s$       )Ú__doc__rrr4Ú__all__r"r#r$rrrr r rr)r+r0rrrrrÚs"     (