
    bi
                     |    d Z ddlZej                  dk(  r ddlZddlmZmZmZmZm	Z	 ddl
mZmZmZ d ZyddlZd Zy)z
Derived from

> https://github.com/rudolfwalter/pygdbmi/blob/0.7.4.2/pygdbmi/gdbcontroller.py
> MIT License  https://github.com/rudolfwalter/pygdbmi/blob/master/LICENSE
> Copyright (c) 2016 Chad Smith <grassfedcode <at> gmail.com>
    Nnt)POINTERWinErrorbyrefwindllwintypes)BOOLDWORDHANDLEc                    t         j                  dk(  rt        t              }t	        j                  d      }t
        j                  j                  }t        |||g|_	        t        |_        t        j                  | j                               }t
        j                  j                  |t        |      dd      }|dk(  rt!        t#                     yt%        j$                  | t$        j&                  t         j(                         y)z
    make file object non-blocking

    Windows doesn't have the fcntl module, but someone on
    stack overflow supplied this code as an answer, and it works
    http://stackoverflow.com/a/34504971/2893090
    r      Nr   )osnamer   r
   r   r   kernel32SetNamedPipeHandleStater   argtypesr	   restypemsvcrtget_osfhandlefilenor   
ValueErrorr   fcntlF_SETFL
O_NONBLOCK)file_objLPDWORDPIPE_NOWAITr   hress         S/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/jupyter_lsp/non_blocking.pymake_non_blockingr!      s     
ww$%.nnZ0"(//"I"I,2GWg+N(*.'  !23oo55a{9KTSWX!8XZ((  	HemmR]];    )__doc__r   r   r   ctypesr   r   r   r   r   ctypes.wintypesr	   r
   r   r   r!    r"   r    <module>r'      s8    
77d?AA33
< <r"   