Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 3, 2024 via pnpm

foreground-child 3.1.1

Run a child as if it's the foreground process. Give it stdio. Exit when it exits.
Package summary
Share
0
issues
2
licenses
4
MIT
4
ISC
Package created
15 May 2015
Version published
18 Apr 2023
Maintainers
3
Total deps
8
Direct deps
2
License
ISC

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
4 Packages, Including:
cross-spawn@7.0.3
path-key@3.1.1
shebang-command@2.0.0
shebang-regex@3.0.0

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
4 Packages, Including:
foreground-child@3.1.1
isexe@2.0.0
signal-exit@4.1.0
which@2.0.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of foreground-child 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
cross-spawn7.0.37.3 kBMIT
prod
signal-exit4.1.013.06 kBISC
prod

Visualizations

Frequently Asked Questions

What does foreground-child do?

Foreground-child is a JavaScript module that allows you to run a child process as if it were the main or foreground process. It hands over console input and output to the child process and makes the parent process exit when the child does. Its primary applications include wrapping child processes for test coverage, as well as any other situation where it's useful to make one program execute another as the main program.

How do you use foreground-child?

Usage of foreground-child is straightforward. First, you need to import the foregroundChild function from the foreground-child module. You then call foregroundChild, passing the command name and any arguments as parameters. The command runs as if it were the main process, and the parent process will exit when the child does.

Here is a basic usage example:

import { foregroundChild } from 'foreground-child'
const child = foregroundChild('cat', [__filename])

You can also provide custom spawn options to control how the child process is spawned:

const child = foregroundChild(`cat ${__filename}`, { shell: true })

and optionally a callback function to be executed before the process exits:

const child = foregroundChild('cat', [__filename], spawnOptions, () => {
  doSomeActions()
})

or a promise for asynchronous actions:

const child = foregroundChild('cat', [__filename], async () => {
  await doSomeAsyncActions()
})

Where are the foreground-child docs?

The documentation for the foreground-child module can be found on the README page in its GitHub repository. The URL for the repository is git+https://github.com/tapjs/foreground-child.git. The README provides clear instructions for using the module and provides several useful examples. Visit the README page to consult the full documentation and get a comprehensive overview of the module.