https://github.com/ratson/promise-exit
Run process.exit() after a promise has finished.
https://github.com/ratson/promise-exit
Last synced: about 1 year ago
JSON representation
Run process.exit() after a promise has finished.
- Host: GitHub
- URL: https://github.com/ratson/promise-exit
- Owner: ratson
- Created: 2016-12-01T13:26:04.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-11-19T13:00:21.000Z (over 8 years ago)
- Last Synced: 2025-03-02T06:49:16.138Z (over 1 year ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# promise-exit
Run `process.exit()` after a promise function has completed.
## Installation
```
npm install promise-exit --save-dev
```
## Usage
```js
const exit = require('promise-exit')
function main() {
return Promise.resolve('Hello World!')
}
if (require.main === module) {
exit(main)
// custom error exit code, default to `1`
exit(main, { errorCode: 255 })
// do not print traceback, default to `true`
exit(main, { trace: false })
// pass arguments to function
exit(main(process.argv))
}