# subprocess

Python API: `hubai_sdk.utils.subprocess`

## Classes

### SubprocessResult

Extension of subprocess.CompletedProcess that also carries peak memory usage.

#### Methods

##### init

```python
def __init__(*args, peak_memory: int, total_time: float, **kwargs):
```

Initialize a subprocess result with memory and timing data.

#### Attributes

##### peak_memory

##### total_time

## Functions

### subprocess_run

```python
def subprocess_run(cmd: str | list[str], *, silent: bool = False) -> SubprocessResult:
```

Wrapper around subprocess.run that logs, raises on error, and tracks peak RAM usage without hanging on stdout/stderr.

Parameters

 * `cmd` (`str | list[str]`): Command to execute. String or list of arguments.
 * `silent` (`bool`): If True, suppress logs.

Returns

 * `SubprocessResult`: SubprocessResult with .peak_memory attribute.
