Skip to content
ocx
install

Project (5 of 6)

Projectclassdataclass#

Re-exported from ocx_sdk._clientView source

exec_asyncmethodasync#

async def exec_async(argv: Sequence[str], *, names: Iterable[str] = (), groups: Iterable[str] = (), clean: bool = False, env: Mapping[str, EnvValue] | None = None, lazy_mode: LazyMode | None = None, pinned: bool | None = None, records_dir: str | Path | None = None, records_name: str | None = None, capture: bool = True, check: bool = True, timeout: MaybeTimeout = UNSET) -> CommandResult

Run a command in the project’s environment, on the event loop.

Parameters

NameTypeDefaultDescription
argvSequence[str]requiredThe command and its arguments. Must not be empty.
namesIterable[str]()Bindings to compose.
groupsIterable[str]()Groups to compose.
cleanboolFalseStrip the ambient parent environment before composing.
envMapping[str, EnvValue] | NoneNoneExtra [env] entries for this call.
lazy_modeLazyMode | NoneNoneWhen content downloads — now, or on first use.
pinnedbool | NoneNoneResolve through pinned digests — see exec.
records_dirstr | Path | NoneNoneWrite an execution record here — see exec.
records_namestr | NoneNoneThe record’s filename template — see exec.
captureboolTruePipe and capture both streams.
checkboolTrueRaise on a non-zero child exit instead of returning it.
timeoutMaybeTimeoutUNSETSeconds for the whole run. Omitted takes the config’s.

Returns

CommandResult
The child’s exit code and, under capture, its output.

Raises

ValueError
argv is empty, or the handle carries an on_log callback, which v0.1 refuses on async paths.
OcxProcessError
The child exited non-zero under check.
OcxTimeoutError
The timeout expired.

spawnmethod#

def spawn(argv: Sequence[str], *, names: Iterable[str] = (), groups: Iterable[str] = (), clean: bool = False, env: Mapping[str, EnvValue] | None = None, lazy_mode: LazyMode | None = None, pinned: bool | None = None, records_dir: str | Path | None = None, records_name: str | None = None, **popen_kw: Any) -> subprocess.Popen[Any]

Start a command in the project’s environment and return Popen.

Parameters

NameTypeDefaultDescription
argvSequence[str]requiredThe command and its arguments. Must not be empty.
namesIterable[str]()Bindings to compose.
groupsIterable[str]()Groups to compose.
cleanboolFalseStrip the ambient parent environment before composing.
envMapping[str, EnvValue] | NoneNoneExtra [env] entries for this call, not the child’s environment — that one is SDK-composed.
lazy_modeLazyMode | NoneNoneWhen content downloads — now, or on first use.
pinnedbool | NoneNoneResolve through pinned digests — see exec.
records_dirstr | Path | NoneNoneWrite an execution record here — see exec.
records_namestr | NoneNoneThe record’s filename template — see exec.
**popen_kwAny{}Forwarded to Popen. args, shell, and executable are rejected.

Returns

subprocess.Popen[Any]
The running child.

Raises

ValueError
argv is empty, or a rejected keyword was passed.