+
    ,j?-                        ^ RI Ht ^ RIt^ RIHtHt  ^ RIHtHt Rt	 ! R R4      t ! R	 R
4      tR#   ]
]3 d    Rt	 L#i ; i)    )annotationsN)BinaryIOOptional)PyPtyProcessPyPtyProcessOptionsTFc                  n    ] tR t^t$ RtR]R&   RR R llt]R R l4       t]	R R	 l4       t
R
 R ltRtR# )PtyProcessOptionszk
Options for creating a PTY process.

Controls behavior like whether input is echoed back to the terminal.
r   _innerc                    V ^8  d   QhRRRR/# )   echoboolreturnNone )formats   "7lib/python3.14/site-packages/rattler/pty/pty_process.py__annotate__PtyProcessOptions.__annotate__   s     0 0T 0T 0    c                T    \         '       g   \        R4      h\        V4      V n        R# )a  
Create options for a PTY process.

Arguments:
    echo: Whether to echo input back to the terminal. Defaults to True.

Examples
--------
```python
>>> from rattler.pty import PtyProcessOptions
>>> # Create with echo enabled (default)
>>> opts = PtyProcessOptions()
>>> opts.echo
True
>>> # Create with echo disabled
>>> opts = PtyProcessOptions(echo=False)
>>> opts.echo
False
>>>
```
3PTY functionality is not available on this platformN)_PTY_AVAILABLEImportErrorr   r
   )selfr   s   &&r   __init__PtyProcessOptions.__init__   s!    , ~STT)$/r   c                    V ^8  d   QhRRRR/# )r   py_pty_process_optionsr   r   r	   r   )r   s   "r   r   r   3   s      BU Zk r   c                4    V P                  V 4      pWn        V# )z.Construct from FFI PyPtyProcessOptions object.__new__r
   )clsr   optss   && r   _from_py_pty_process_options.PtyProcessOptions._from_py_pty_process_options2   s     {{3,r   c                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r   r   r   :   s        d  r   c                .    V P                   P                  # )z-Whether input is echoed back to the terminal.)r
   r   r   s   &r   r   PtyProcessOptions.echo9   s     {{r   c                   V ^8  d   QhRR/# r   r   strr   )r   s   "r   r   r   >   s     6 6# 6r   c                	"    R V P                    R2# )zPtyProcessOptions(echo=))r   r)   s   &r   __repr__PtyProcessOptions.__repr__>   s    (155r   r
   N)T)__name__
__module____qualname____firstlineno____doc____annotations__r   classmethodr%   propertyr   r0   __static_attributes__r   r   r   r	   r	      sF      04      6 6r   r	   c                     ] tR t^Bt$ RtR]R&   R R R llt]R R l4       t]	R	 R
 l4       t
R R ltR R ltR R lt]	R R l4       t]P                  R R l4       tR!R R lltR R ltR R ltR R ltR R ltRtR# )"
PtyProcessa  
A pseudoterminal (PTY) process.

This is the lower-level PTY API that gives you more control over the process.
Use this when you need to:
- Read/write to the PTY manually using file handles
- Check process status
- Control process termination with specific signals

For interactive shell sessions, consider using `PtySession` instead, which
provides higher-level conveniences like `send_line()` and `interact()`.
r   r
   Nc               $    V ^8  d   QhRRRRRR/# )r   commandz	list[str]optionszOptional[PtyProcessOptions]r   r   r   )r   s   "r   r   PtyProcess.__annotate__R   s(     "@ "@	 "@4O "@[_ "@r   c                    \         '       g   \        R4      hVf   \        V4      V n        R# \        WP                  4      V n        R# )a   
Create a new PTY process with the given command.

Arguments:
    command: A list of strings representing the command and its arguments.
             The first element is the executable, subsequent elements are arguments.
    options: Optional PtyProcessOptions to configure the PTY behavior.
             If not provided, defaults to echo=True.

Raises:
    RuntimeError: If the PTY process could not be created.

Examples
--------
```python
>>> from rattler.pty import PtyProcess, PtyProcessOptions
>>> # Create with default options (echo enabled)
>>> process = PtyProcess(["bash"])
>>> # Create with custom options
>>> opts = PtyProcessOptions(echo=False)
>>> process = PtyProcess(["bash", "-l"], opts)
>>> # Check process status
>>> status = process.status()
>>> print(status)
StillAlive
>>>
```
r   N)r   r   r   r
   )r   r?   r@   s   &&&r   r   PtyProcess.__init__R   s6    : ~STT?&w/DK&w?DKr   c                    V ^8  d   QhRRRR/# )r   py_pty_processr   r   r=   r   )r   s   "r   r   rA   w   s      , : r   c                4    V P                  V 4      pWn        V# )z'Construct from FFI PyPtyProcess object.r!   )r#   rE   processs   && r   _from_py_pty_processPtyProcess._from_py_pty_processv   s     ++c"'r   c                   V ^8  d   QhRR/# )r   r   intr   )r   s   "r   r   rA   ~   s     % %3 %r   c                .    V P                   P                  # )z
Get the process ID (PID) of the child process.

Returns:
    The PID as an integer.

Examples
--------
```python
>>> process = PtyProcess(["bash"])
>>> pid = process.child_pid
>>> print(f"Process ID: {pid}")
Process ID: 12345
>>>
```
)r
   	child_pidr)   s   &r   rM   PtyProcess.child_pid}   s    $ {{$$$r   c                   V ^8  d   QhRR/# )r   r   zOptional[str]r   )r   s   "r   r   rA      s     $ $ $r   c                6    V P                   P                  4       # )a  
Check the status of the child process (non-blocking).

This runs waitpid() with WNOHANG, so it returns immediately.
Note: If you previously called exit() or status() returned an exit status,
subsequent calls may return None.

Returns:
    A string representing the process status, or None if status cannot be determined.
    Possible values:
    - "StillAlive": Process is still running
    - "Exited(code)": Process exited with the given exit code
    - "Signaled(signal)": Process was terminated by a signal
    - "Stopped": Process was stopped

Examples
--------
```python
>>> import time
>>> process = PtyProcess(["sleep", "10"])
>>> print(process.status())
StillAlive
>>> time.sleep(11)
>>> print(process.status())
Exited(0)
>>>
```
)r
   statusr)   s   &r   rQ   PtyProcess.status   s    : {{!!##r   c                   V ^8  d   QhRR/# r,   r   )r   s   "r   r   rA      s     " "c "r   c                6    V P                   P                  4       # )a  
Exit the process gracefully by sending SIGTERM.

This method blocks until the process has exited. If the process doesn't
respond to SIGTERM, it will eventually be killed with SIGKILL if a
kill_timeout was set (not currently exposed to Python).

Returns:
    A string describing the exit status.

Raises:
    RuntimeError: If the process could not be terminated.

Examples
--------
```python
>>> process = PtyProcess(["bash"])
>>> status = process.exit()
>>> print(status)
Exited(0)
>>>
```
)r
   exitr)   s   &r   rU   PtyProcess.exit   s    0 {{!!r   c                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r   r   rA      s     1 1 1r   c                h    V P                   P                  4       p\        P                  ! VR^ R7      # )a  
Get a file handle for reading from and writing to the PTY.

This returns a Python file-like object that can be used to read output
from the process and write input to it. This is useful for non-interactive
automation where you want to programmatically read the process output.

Returns:
    A Python binary file object for reading/writing to the PTY.

Raises:
    RuntimeError: If the file handle could not be created.

Examples
--------
```python
>>> process = PtyProcess(["bash"])
>>> file = process.get_file_handle()
>>> # Write to the process
>>> file.write(b"echo hello\n")
>>> file.flush()
>>> # Read output (this is a blocking operation)
>>> output = file.read(100)
>>> print(output)
>>>
```
zr+b)	buffering)r
   get_file_handleosfdopen)r   fds   & r   rZ   PtyProcess.get_file_handle   s)    8 [[((*yyUa00r   c                   V ^8  d   QhRR/# )r   r   Optional[float]r   )r   s   "r   r   rA      s     . .o .r   c                6    V P                   P                  4       # )ac  
Get the kill timeout in seconds.

When calling exit() or async_exit(), if the process doesn't respond to
SIGTERM within this timeout, it will be forcefully killed with SIGKILL.

Returns:
    The timeout in seconds, or None if no timeout is set.

Examples
--------
```python
>>> process = PtyProcess(["bash"])
>>> print(process.kill_timeout)
None
>>>
```
)r
   get_kill_timeoutr)   s   &r   kill_timeoutPtyProcess.kill_timeout   s    ( {{++--r   c                    V ^8  d   QhRRRR/# )r   timeoutr`   r   r   r   )r   s   "r   r   rA      s     . .O . .r   c                <    V P                   P                  V4       R# )a  
Set the kill timeout in seconds.

Arguments:
    timeout: Timeout in seconds, or None to disable timeout.

Examples
--------
```python
>>> process = PtyProcess(["bash"])
>>> process.kill_timeout = 5.0  # 5 second timeout
>>> process.kill_timeout = None  # Disable timeout
>>>
```
N)r
   set_kill_timeout)r   rf   s   &&r   rc   rd      s    " 	$$W-r   c                    V ^8  d   QhRRRR/# )r   sizerK   r   bytesr   )r   s   "r   r   rA     s     2 2S 2E 2r   c                T   "   V P                   P                  V4      G Rj  xL
 #  L5i)aC  
Read from the PTY asynchronously.

This is the async version of reading via get_file_handle(). It performs
non-blocking I/O using tokio on the Rust side, bridged to Python's asyncio.

Arguments:
    size: Maximum number of bytes to read. Defaults to 8192.

Returns:
    Bytes read from the PTY.

Raises:
    RuntimeError: If the read operation fails.

Examples
--------
```python
>>> import asyncio
>>> async def main():
...     process = PtyProcess(["bash", "-c", "echo hello"])
...     data = await process.async_read(1024)
...     print(data)
>>> asyncio.run(main())
>>>
```
N)r
   
async_read)r   rj   s   &&r   rm   PtyProcess.async_read  s"     8 [[++D1111   (&(c                    V ^8  d   QhRRRR/# )r   datark   r   rK   r   )r   s   "r   r   rA   0  s     3 3e 3 3r   c                T   "   V P                   P                  V4      G Rj  xL
 #  L5i)a&  
Write to the PTY asynchronously.

This is the async version of writing via get_file_handle(). It performs
non-blocking I/O using tokio on the Rust side.

Arguments:
    data: Bytes to write to the PTY.

Returns:
    The number of bytes written.

Raises:
    RuntimeError: If the write operation fails.

Examples
--------
```python
>>> import asyncio
>>> async def main():
...     process = PtyProcess(["cat"])
...     n = await process.async_write(b"hello\n")
...     print(f"Wrote {n} bytes")
...     process.exit()
>>> asyncio.run(main())
>>>
```
N)r
   async_write)r   rq   s   &&r   rs   PtyProcess.async_write0  s"     : [[,,T2222ro   c                   V ^8  d   QhRR/# r,   r   )r   s   "r   r   rA   O  s     . .# .r   c                R   "   V P                   P                  4       G Rj  xL
 #  L5i)a  
Wait for the process to exit asynchronously.

This is the async version of polling status() in a loop. It polls the
process status periodically without blocking the async runtime.

Returns:
    A string describing the exit status.

Raises:
    RuntimeError: If waiting fails.

Examples
--------
```python
>>> import asyncio
>>> async def main():
...     process = PtyProcess(["sleep", "1"])
...     status = await process.async_wait()
...     print(status)
>>> asyncio.run(main())
Exited(0)
>>>
```
N)r
   
async_waitr)   s   &r   rw   PtyProcess.async_waitO  s      4 [[++----   '%'c                   V ^8  d   QhRR/# r,   r   )r   s   "r   r   rA   k  s     . .# .r   c                R   "   V P                   P                  4       G Rj  xL
 #  L5i)a  
Exit the process gracefully asynchronously by sending SIGTERM.

This is the async version of exit(). It sends SIGTERM and waits for
the process to terminate without blocking the async runtime.

Returns:
    A string describing the exit status.

Raises:
    RuntimeError: If the process could not be terminated.

Examples
--------
```python
>>> import asyncio
>>> async def main():
...     process = PtyProcess(["bash"])
...     status = await process.async_exit()
...     print(status)
>>> asyncio.run(main())
>>>
```
N)r
   
async_exitr)   s   &r   r|   PtyProcess.async_exitk  s      2 [[++----ry   c                   V ^8  d   QhRR/# r,   r   )r   s   "r   r   rA     s     9 9# 9r   c                	"    R V P                    R2# )zPtyProcess(child_pid=r/   )rM   r)   s   &r   r0   PtyProcess.__repr__  s    &t~~&6a88r   r2   )N)i    )r3   r4   r5   r6   r7   r8   r   r9   rH   r:   rM   rQ   rU   rZ   rc   setterrm   rs   rw   r|   r0   r;   r   r   r   r=   r=   B   s     "@H   % %&$>"41> . .* . .$2<3>.8.69 9r   r=   )
__future__r   r[   typingr   r   rattler.rattlerr   r   r   r   AttributeErrorr	   r=   r   r   r   <module>r      sN    " 	 %AN
06 06fE9 E9o 	^$ Ns   
4 AA