Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # signal-exit
  2. [![Build Status](https://travis-ci.org/tapjs/signal-exit.png)](https://travis-ci.org/tapjs/signal-exit)
  3. [![Coverage](https://coveralls.io/repos/tapjs/signal-exit/badge.svg?branch=master)](https://coveralls.io/r/tapjs/signal-exit?branch=master)
  4. [![NPM version](https://img.shields.io/npm/v/signal-exit.svg)](https://www.npmjs.com/package/signal-exit)
  5. [![Windows Tests](https://img.shields.io/appveyor/ci/bcoe/signal-exit/master.svg?label=Windows%20Tests)](https://ci.appveyor.com/project/bcoe/signal-exit)
  6. [![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
  7. When you want to fire an event no matter how a process exits:
  8. * reaching the end of execution.
  9. * explicitly having `process.exit(code)` called.
  10. * having `process.kill(pid, sig)` called.
  11. * receiving a fatal signal from outside the process
  12. Use `signal-exit`.
  13. ```js
  14. var onExit = require('signal-exit')
  15. onExit(function (code, signal) {
  16. console.log('process exited!')
  17. })
  18. ```
  19. ## API
  20. `var remove = onExit(function (code, signal) {}, options)`
  21. The return value of the function is a function that will remove the
  22. handler.
  23. Note that the function *only* fires for signals if the signal would
  24. cause the proces to exit. That is, there are no other listeners, and
  25. it is a fatal signal.
  26. ## Options
  27. * `alwaysLast`: Run this handler after any other signal or exit
  28. handlers. This causes `process.emit` to be monkeypatched.