Files
renovate[bot] 1909c2ef22 build(deps): update dependency execa to v10 (main) (#45834)
* build(deps): update dependency execa to v10

| datasource | package | from  | to     |
| ---------- | ------- | ----- | ------ |
| npm        | execa   | 8.0.1 | 10.0.1 |

* fix(exec): adapt to execa v10 types and subprocess API

* fix(tools): type execa v10 results in hook exec and mkdocs

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: secustor <sebastian@poxhofer.at>
2026-09-25 09:00:52 +00:00

25 lines
656 B
TypeScript

import type { Options, Result } from 'execa';
import { execa } from 'execa';
const maxBuffer = 20 * 1024 * 1024;
/** execa options producing text output, which excludes the binary encodings */
export type TextOptions = Extract<
Options,
{ readonly encoding?: 'utf8' | 'utf16le' }
>;
/**
* Execute a command asynchronously using execa
*/
export async function exec<T extends TextOptions = Record<never, never>>(
cmd: string,
args: string[] = [],
opts?: T,
): Promise<Result<T & { encoding: 'utf8' }>> {
const options = { ...opts, maxBuffer, encoding: 'utf8' } as T & {
encoding: 'utf8';
};
return await execa(cmd, args, options);
}