Home / Function/ shell() — astro Function Reference

shell() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  050beaec_3ff7_b15f_6546_1bd5bc24c0e5["shell()"]
  06129415_09ea_fe35_36b2_5c1cf09b4686["shell.ts"]
  050beaec_3ff7_b15f_6546_1bd5bc24c0e5 -->|defined in| 06129415_09ea_fe35_36b2_5c1cf09b4686
  52178162_54b3_ff66_aca4_21913ebea63b["text()"]
  050beaec_3ff7_b15f_6546_1bd5bc24c0e5 -->|calls| 52178162_54b3_ff66_aca4_21913ebea63b
  style 050beaec_3ff7_b15f_6546_1bd5bc24c0e5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/create-astro/src/shell.ts lines 21–50

export async function shell(
	command: string,
	flags: string[],
	opts: ExecaOptions = {},
): Promise<Output> {
	let child: ChildProcess;
	let stdout = '';
	let stderr = '';
	try {
		child = spawn(command, flags, {
			cwd: opts.cwd,
			shell: true,
			stdio: opts.stdio,
			timeout: opts.timeout,
		});
		const done = new Promise((resolve) => child.on('close', resolve));
		[stdout, stderr] = await Promise.all([text(child.stdout), text(child.stderr)]);
		await done;
	} catch {
		throw { stdout, stderr, exitCode: 1 };
	}
	const { exitCode } = child;
	if (exitCode === null) {
		throw new Error('Timeout');
	}
	if (exitCode !== 0) {
		throw new Error(stderr);
	}
	return { stdout, stderr, exitCode };
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does shell() do?
shell() is a function in the astro codebase, defined in packages/create-astro/src/shell.ts.
Where is shell() defined?
shell() is defined in packages/create-astro/src/shell.ts at line 21.
What does shell() call?
shell() calls 1 function(s): text.

Analyze Your Own Codebase

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

Try Supermodel Free