Home / Function/ execute() — astro Function Reference

execute() — astro Function Reference

Architecture documentation for the execute() function in tinyexec-command-executor.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  74cd759c_1db4_bbee_8547_78faa1370d62["execute()"]
  f404269d_1fc6_db08_73a1_e6fa7662e449["TinyexecCommandExecutor"]
  74cd759c_1db4_bbee_8547_78faa1370d62 -->|defined in| f404269d_1fc6_db08_73a1_e6fa7662e449
  style 74cd759c_1db4_bbee_8547_78faa1370d62 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/cli/infra/tinyexec-command-executor.ts lines 5–38

	async execute(
		command: string,
		args?: Array<string>,
		options?: CommandExecutorOptions,
	): Promise<{ stdout: string }> {
		const proc = x(command, args, {
			throwOnError: true,
			nodeOptions: {
				cwd: options?.cwd,
				env: options?.env,
				shell: options?.shell,
				stdio: options?.stdio,
			},
		});
		if (options?.input) {
			proc.process?.stdin?.end(options.input);
		}
		return await proc.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 execute() do?
execute() is a function in the astro codebase, defined in packages/astro/src/cli/infra/tinyexec-command-executor.ts.
Where is execute() defined?
execute() is defined in packages/astro/src/cli/infra/tinyexec-command-executor.ts at line 5.

Analyze Your Own Codebase

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

Try Supermodel Free