Relevant source files
- docs/api.md
API Reference
Overview
The Execa API provides a set of functions and classes for executing commands and handling their output. This reference covers the available API endpoints.
Executing Commands
Execa provides the execa function, which takes a command and its arguments as strings and executes the command. The function returns a ChildProcess object, which provides information about the executed process.
ChildProcess
The ChildProcess object represents a child process executed by Execa. It provides information about the process, such as its exit code, stdout, and stderr.
API Endpoints
execa
execa(command, args, options): Execute a command and its arguments.
ChildProcess
childProcess.exitCode: The exit code of the child process.childProcess.stdout: The stdout of the child process.childProcess.stderr: The stderr of the child process.
Example Usage
const { execa } = require('execa');
const childProcess = await execa('node', ['--version']);
console.log(childProcess.stdout.toString());
graph TD A[User calls execa] B[execa function is called] C[Command and arguments are executed] D[ChildProcess object is returned] E[User accesses ChildProcess properties] A-->B B-->C C-->D D-->E
Sources: docs/api.md