UNPKG

close-with-grace

Version:

Exit your process, gracefully (if possible)

14 lines (10 loc) 319 B
'use strict' const closeWithGrace = require('..') closeWithGrace({ delay: 500 }, function ({ signal, err }) { console.log('fn called') // this promise never resolves, so the delay should kick in return new Promise(() => {}) }) // to keep the process open setInterval(() => {}, 1000) console.error(process.pid)