o
    È·eß
  ã                   @   sh   d dl mZ d dlZd dlZzd dlZd dlZdZW n ey%   dZY nw dd„ Zdd„ Z	d	d
„ Z
dS )é    )Úprint_functionNTFc                 C   s   t rt| ƒ d S t| ƒ d S )N)Úhas_termiosÚposix_shellÚwindows_shell)Úchan© r   úO/var/www/ideatree/venv/lib/python3.10/site-packages/boto/mashups/interactive.pyÚinteractive_shell    s   r	   c                 C   s.  dd l }t tj¡}z‚t tj ¡ ¡ t tj ¡ ¡ |  	d¡ 	 |  | tjgg g ¡\}}}| |v r]z |  
d¡}t|ƒdkrFtddd W n/tj |¡ tj ¡  W n
 tjy\   Y nw tj|v rttj d¡}t|ƒdkron|  |¡ q!W t tjtj|¡ d S W t tjtj|¡ d S t tjtj|¡ w )	Nr   g        Ti   z
*** EOF
ú )Úendé   )ÚselectÚtermiosÚ	tcgetattrÚsysÚstdinÚttyÚsetrawÚfilenoÚ	setcbreakÚ
settimeoutÚrecvÚlenÚprintÚstdoutÚwriteÚflushÚsocketÚtimeoutÚreadÚsendÚ	tcsetattrÚ	TCSADRAIN)r   r   ÚoldttyÚrÚwÚeÚxr   r   r   r   '   s:   

ÿ

ðü*r   c                 C   sn   dd l }tj d¡ dd„ }|j|| fd}| ¡  z	 tj d¡}|s'W d S |  |¡ q t	y6   Y d S w )Nr   zALine-buffered terminal emulation. Press F6 or ^Z to send EOF.

c                 S   sB   	 |   d¡}|stj d¡ tj ¡  d S tj |¡ tj ¡  q)NTé   z
*** EOF ***

)r   r   r   r   r   )ÚsockÚdatar   r   r   ÚwriteallL   s   


ùzwindows_shell.<locals>.writeall)ÚtargetÚargsTr   )
Ú	threadingr   r   r   ÚThreadÚstartr   r   r    ÚEOFError)r   r.   r+   ÚwriterÚdr   r   r   r   G   s   

üþr   )Ú
__future__r   r   r   r   r   r   ÚImportErrorr	   r   r   r   r   r   r   Ú<module>   s   ÿ 