shell() — astro Function Reference
Architecture documentation for the shell() function in shell.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 7b8ba1ba_216b_7b10_7cb6_8262d181f635["shell()"] 10115483_0549_8783_e6e6_0b4589ba34bd["shell.ts"] 7b8ba1ba_216b_7b10_7cb6_8262d181f635 -->|defined in| 10115483_0549_8783_e6e6_0b4589ba34bd bd430999_8b7b_9369_2230_39cec30b9bc8["text()"] 7b8ba1ba_216b_7b10_7cb6_8262d181f635 -->|calls| bd430999_8b7b_9369_2230_39cec30b9bc8 style 7b8ba1ba_216b_7b10_7cb6_8262d181f635 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/upgrade/src/shell.ts lines 22–59
export async function shell(
command: string,
flags: string[],
opts: ExecaOptions = {},
): Promise<Output> {
let child: ChildProcess;
let stdout = '';
let stderr = '';
if (!signal) {
const controller = new AbortController();
// Ensure spawned process is cancelled on exit
process.once('beforeexit', () => controller.abort());
process.once('exit', () => controller.abort());
signal = controller.signal;
}
try {
child = spawn(`${command} ${flags.join(' ')}`, {
cwd: opts.cwd,
shell: true,
stdio: opts.stdio,
timeout: opts.timeout,
signal,
});
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
Defined In
Calls
Source
Frequently Asked Questions
What does shell() do?
shell() is a function in the astro codebase, defined in packages/upgrade/src/shell.ts.
Where is shell() defined?
shell() is defined in packages/upgrade/src/shell.ts at line 22.
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