Skip to content
ocx
install

PackageCommands (10 of 16)

PackageCommandsclassdataclass#

Re-exported from ocx_sdk._clientView source

exec_asyncmethodasync#

async def exec_async(refs: Sequence[PackageLike], argv: Sequence[str], *, platform: str | None = None, clean: bool = False, private: bool = False, env: Mapping[str, EnvValue] | None = None, lazy_mode: LazyMode | 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 a packages’ environment, on the event loop.

Parameters

NameTypeDefaultDescription
refsSequence[PackageLike]requiredPackage identifiers to compose.
argvSequence[str]requiredThe command and its arguments. Must not be empty.
platformstr | NoneNoneThe platform to resolve against.
cleanboolFalseStrip the ambient parent environment before composing.
privateboolFalseCompose the private surface — ocx’s --self.
envMapping[str, EnvValue] | NoneNoneExtra [env] entries for this call.
lazy_modeLazyMode | NoneNoneWhen content downloads — now, or on first use.
records_dirstr | Path | NoneNoneWrite an execution record — the resolved closure and executable — under this directory. None leaves it to [records] dir and OCX_RECORDS_DIR; with none of the three, no record is written.
records_namestr | NoneNoneThe record’s filename template, over {time}, {host}, {pid} and {rand}. None leaves it to [records] name and OCX_RECORDS_NAME.
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.