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 Dec 20, 2023 via pnpm

signal-exit 1.3.0

when you want process.on('exit') to fire when a process is killed with a signal.
Package summary
Share
0
issues
0
licenses
Package created
16 May 2015
Version published
19 May 2015
Maintainers
2
Total deps
0
Direct deps
0
License
ISC

Issues

0
This package has no issues

Frequently Asked Questions

What does signal-exit do?

Signal-exit is a JavaScript package that aids in firing an event, regardless of how a process exits. This can include a process reaching the end of execution, explicitly having process.exit(code) called, process.kill(pid, sig) called, or receiving a fatal signal from outside the process. Signal-exit proves to be an advantageous tool when developers wish to capture all possible process exit scenarios within their applications.

How do you use signal-exit?

To use the signal-exit package, you first need to import it into your JavaScript application. There are two ways to do this, either by using the ES6 import syntax or the CommonJS require syntax. After the importation is successfully done, you can then call the onExit function which fires when a process exits.

Here is a simple usage example demonstrating these steps:

// Import signal-exit using ES6 syntax
import { onExit } from 'signal-exit';
// Or you can import using CommonJS syntax
// const { onExit } = require('signal-exit');

onExit((code, signal) => {
  console.log('process exited!', code, signal)
});

The onExit function takes a callback function as its parameter which will be executed when the process exits. The callback function receives the exit code and signal as its arguments.

Where are the signal-exit docs?

The official documentation for signal-exit can be found in the package's README on GitHub at https://github.com/tapjs/signal-exit. Here, you will find a thorough description of the package, how to use it, example code snippets, and other useful explanations and references. For a deep-dive into the package usage and customization options, this is the best place to start.