Home / Function/ exec() — astro Function Reference

exec() — astro Function Reference

Architecture documentation for the exec() function in exec.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  63fefd7e_c8e0_bf2b_a4f6_068e61109e82["exec()"]
  cb5e589f_648f_13de_9bb2_bc601536a651["exec.ts"]
  63fefd7e_c8e0_bf2b_a4f6_068e61109e82 -->|defined in| cb5e589f_648f_13de_9bb2_bc601536a651
  style 63fefd7e_c8e0_bf2b_a4f6_068e61109e82 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/cli/exec.ts lines 7–27

export function exec(command: string, args?: string[], options?: Partial<Options>) {
	return x(command, args, {
		throwOnError: true,
		...options,
	}).then(
		(o) => o,
		(e) => {
			if (e instanceof NonZeroExitError) {
				const fullCommand = args?.length
					? `${command} ${args.map((a) => (a.includes(' ') ? `"${a}"` : a)).join(' ')}`
					: command;
				const message = `The command \`${fullCommand}\` exited with code ${e.exitCode}`;
				const newError = new Error(message, e.cause ? { cause: e.cause } : undefined);
				(newError as any).stderr = e.output?.stderr;
				(newError as any).stdout = e.output?.stdout;
				throw newError;
			}
			throw e;
		},
	);
}

Domain

Subdomains

Frequently Asked Questions

What does exec() do?
exec() is a function in the astro codebase, defined in packages/astro/src/cli/exec.ts.
Where is exec() defined?
exec() is defined in packages/astro/src/cli/exec.ts at line 7.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free