Home / Class/ TinyexecCommandExecutor Class — astro Architecture

TinyexecCommandExecutor Class — astro Architecture

Architecture documentation for the TinyexecCommandExecutor class in tinyexec-command-executor.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  f404269d_1fc6_db08_73a1_e6fa7662e449["TinyexecCommandExecutor"]
  9d1bd286_579c_304a_974b_f3a4fc3e5522["tinyexec-command-executor.ts"]
  f404269d_1fc6_db08_73a1_e6fa7662e449 -->|defined in| 9d1bd286_579c_304a_974b_f3a4fc3e5522
  74cd759c_1db4_bbee_8547_78faa1370d62["execute()"]
  f404269d_1fc6_db08_73a1_e6fa7662e449 -->|method| 74cd759c_1db4_bbee_8547_78faa1370d62

Relationship Graph

Source Code

packages/astro/src/cli/infra/tinyexec-command-executor.ts lines 4–39

export class TinyexecCommandExecutor implements CommandExecutor {
	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

Frequently Asked Questions

What is the TinyexecCommandExecutor class?
TinyexecCommandExecutor is a class in the astro codebase, defined in packages/astro/src/cli/infra/tinyexec-command-executor.ts.
Where is TinyexecCommandExecutor defined?
TinyexecCommandExecutor is defined in packages/astro/src/cli/infra/tinyexec-command-executor.ts at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free