Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/askui/tools/pynput/pynput_agent_os.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import ctypes
import platform
import queue
import shlex
import subprocess
import time
from functools import wraps
from typing import TYPE_CHECKING, Any, Callable, Literal, TypeVar, cast
Expand Down Expand Up @@ -348,6 +350,22 @@ def set_display(self, display: int = 1) -> None:
raise ValueError(error_msg)
self._display = display

@override
def run_command(self, command: str, timeout_ms: int = 30000) -> None:
"""
Run a shell command.

Args:
command (str): The command to run.
timeout_ms (int, optional): Timeout in milliseconds. Defaults to 30000.

Raises:
subprocess.TimeoutExpired: If the command takes longer than the timeout.
subprocess.CalledProcessError: If the command returns a non-zero exit code.
"""

subprocess.run(shlex.split(command), timeout=timeout_ms / 1000)

def _on_mouse_click(
self, x: float, y: float, button: Button, pressed: bool, injected: bool
) -> None:
Expand Down