MCPcopy Create free account
hub / github.com/vercel/vercel / execResolvedVercelCli

Function execResolvedVercelCli

packages/cli-exec/src/exec.ts:64–100  ·  view source on GitHub ↗

* Resolves one CLI invocation and executes it once.

(
  args: string[],
  options: ExecVercelCliOptions,
  cwd: string,
  env: NodeJS.ProcessEnv,
  pathValue: string
)

Source from the content-addressed store, hash-verified

62 * Resolves one CLI invocation and executes it once.
63 */
64async function execResolvedVercelCli(
65 args: string[],
66 options: ExecVercelCliOptions,
67 cwd: string,
68 env: NodeJS.ProcessEnv,
69 pathValue: string
70): Promise<ExecVercelCliResult> {
71 const invocation = await resolveInvocationOrThrow(cwd, pathValue);
72
73 try {
74 const execaOptions: ExecaOptions = {
75 input: options.input,
76 stdio: options.stdio,
77 stdin: options.stdin,
78 stdout: options.stdout,
79 stderr: options.stderr,
80 timeout: options.timeout,
81 cwd,
82 env: await prependLocalBinsToEnvPath(cwd, env),
83 windowsHide: true,
84 };
85
86 if (options.signal) {
87 execaOptions.signal = options.signal;
88 }
89
90 const { stdout, stderr } = await execa(
91 invocation.command,
92 [...invocation.commandArgs, ...args],
93 execaOptions
94 );
95
96 return { stdout, stderr, invocation };
97 } catch (error) {
98 throw toVercelCliError(invocation, error);
99 }
100}
101
102/**
103 * Resolves the cached CLI invocation or throws with resolution diagnostics.

Callers 1

execVercelCliFunction · 0.85

Calls 4

toVercelCliErrorFunction · 0.90
resolveInvocationOrThrowFunction · 0.85
execaFunction · 0.85

Tested by

no test coverage detected