Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

handle-quit

0.1.1 • Public • Published

handle-quit Build status for handle-quit on Circle CI.

Teach your process to shutdown gracefully.

Why?

  • Friendly to your users.
  • Easy to use and reason about.
  • Enables zero-downtime deployments.

Install

npm install handle-quit --save

Usage

Get it into your program.

const handleQuit = require('handle-quit');

Make sure your program shuts down gracefully or quickly, as necessary.

handleQuit(() => {
    server.close();
});

API

handleQuit(listener)

Listens for SIGINT and runs a graceful shutdown on the first signal. Calls process.exit() upon any future SIGINT signals. Relevant shutdown messages are also printed to the console.

listener

Type: function

A function that will gracefully shutdown your program. A common example is Server#close().

Contributing

See our contributing guidelines for more details.

  1. Fork it.
  2. Make a feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.

License

MPL-2.0 © Seth Holladay

Go make something, dang it.

install

npm i handle-quit

Downloadsweekly downloads

29

version

0.1.1

license

MPL-2.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability