about summary refs log tree commit diff
path: root/.venv/lib/python3.12/site-packages/anyio/abc/_subprocesses.py
diff options
context:
space:
mode:
authorS. Solomon Darnell2025-03-28 21:52:21 -0500
committerS. Solomon Darnell2025-03-28 21:52:21 -0500
commit4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch)
treeee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/anyio/abc/_subprocesses.py
parentcc961e04ba734dd72309fb548a2f97d67d578813 (diff)
downloadgn-ai-4a52a71956a8d46fcb7294ac71734504bb09bcc2.tar.gz
two version of R2R are here HEAD master
Diffstat (limited to '.venv/lib/python3.12/site-packages/anyio/abc/_subprocesses.py')
-rw-r--r--.venv/lib/python3.12/site-packages/anyio/abc/_subprocesses.py79
1 files changed, 79 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/anyio/abc/_subprocesses.py b/.venv/lib/python3.12/site-packages/anyio/abc/_subprocesses.py
new file mode 100644
index 00000000..ce0564ce
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/anyio/abc/_subprocesses.py
@@ -0,0 +1,79 @@
+from __future__ import annotations
+
+from abc import abstractmethod
+from signal import Signals
+
+from ._resources import AsyncResource
+from ._streams import ByteReceiveStream, ByteSendStream
+
+
+class Process(AsyncResource):
+    """An asynchronous version of :class:`subprocess.Popen`."""
+
+    @abstractmethod
+    async def wait(self) -> int:
+        """
+        Wait until the process exits.
+
+        :return: the exit code of the process
+        """
+
+    @abstractmethod
+    def terminate(self) -> None:
+        """
+        Terminates the process, gracefully if possible.
+
+        On Windows, this calls ``TerminateProcess()``.
+        On POSIX systems, this sends ``SIGTERM`` to the process.
+
+        .. seealso:: :meth:`subprocess.Popen.terminate`
+        """
+
+    @abstractmethod
+    def kill(self) -> None:
+        """
+        Kills the process.
+
+        On Windows, this calls ``TerminateProcess()``.
+        On POSIX systems, this sends ``SIGKILL`` to the process.
+
+        .. seealso:: :meth:`subprocess.Popen.kill`
+        """
+
+    @abstractmethod
+    def send_signal(self, signal: Signals) -> None:
+        """
+        Send a signal to the subprocess.
+
+        .. seealso:: :meth:`subprocess.Popen.send_signal`
+
+        :param signal: the signal number (e.g. :data:`signal.SIGHUP`)
+        """
+
+    @property
+    @abstractmethod
+    def pid(self) -> int:
+        """The process ID of the process."""
+
+    @property
+    @abstractmethod
+    def returncode(self) -> int | None:
+        """
+        The return code of the process. If the process has not yet terminated, this will
+        be ``None``.
+        """
+
+    @property
+    @abstractmethod
+    def stdin(self) -> ByteSendStream | None:
+        """The stream for the standard input of the process."""
+
+    @property
+    @abstractmethod
+    def stdout(self) -> ByteReceiveStream | None:
+        """The stream for the standard output of the process."""
+
+    @property
+    @abstractmethod
+    def stderr(self) -> ByteReceiveStream | None:
+        """The stream for the standard error output of the process."""