Home / File/ tinyexec-command-executor.ts — astro Source File

tinyexec-command-executor.ts — astro Source File

Architecture documentation for tinyexec-command-executor.ts, a typescript file in the astro codebase. 2 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  9d1bd286_579c_304a_974b_f3a4fc3e5522["tinyexec-command-executor.ts"]
  7db42c05_e873_0887_a39f_34451c181149["../definitions.js"]
  9d1bd286_579c_304a_974b_f3a4fc3e5522 --> 7db42c05_e873_0887_a39f_34451c181149
  015e2115_00b7_8619_a3f3_dc6eceb4c058["tinyexec"]
  9d1bd286_579c_304a_974b_f3a4fc3e5522 --> 015e2115_00b7_8619_a3f3_dc6eceb4c058
  style 9d1bd286_579c_304a_974b_f3a4fc3e5522 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { NonZeroExitError, x } from 'tinyexec';
import type { CommandExecutor, CommandExecutorOptions } from '../definitions.js';

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

Subdomains

Dependencies

  • ../definitions.js
  • tinyexec

Frequently Asked Questions

What does tinyexec-command-executor.ts do?
tinyexec-command-executor.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What does tinyexec-command-executor.ts depend on?
tinyexec-command-executor.ts imports 2 module(s): ../definitions.js, tinyexec.
Where is tinyexec-command-executor.ts in the architecture?
tinyexec-command-executor.ts is located at packages/astro/src/cli/infra/tinyexec-command-executor.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/cli/infra).

Analyze Your Own Codebase

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

Try Supermodel Free