package
A small set of utilities for child process.
npm install @simple-libs/child-process-utilsGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 2 packages.
25.5 kB
Includes dependencies.
A small set of utilities for child process.
# pnpm
pnpm add @simple-libs/child-process-utils
# yarn
yarn add @simple-libs/child-process-utils
# npm
npm i @simple-libs/child-process-utilsimport {
exitCode,
catchProcessError,
throwProcessError,
outputStream,
output
} from '@simple-libs/child-process-utils'
// Wait for a child process to exit and return its exit code
await exitCode(spawn())
// Returns 0 if the process exited successfully, or the exit code if it failed
// Catch error from a child process
await catchProcessError(spawn())
// Returns the error if the process failed, or null if it succeeded
// Throws an error if the child process exits with a non-zero code.
await throwProcessError(spawn())
// Yields the stdout of a child process.
// It will throw an error if the process exits with a non-zero code.
for await (chunk of outputStream(spawn())) {