tauri/cli/tauri.js/helpers/on-shutdown.js

16 lines
291 B
JavaScript
Raw Normal View History

module.exports = function (fn) {
const cleanup = () => {
try {
fn()
} finally {
process.exit()
}
}
process.on('exit', cleanup)
process.on('SIGINT', cleanup)
process.on('SIGTERM', cleanup)
process.on('SIGHUP', cleanup)
process.on('SIGBREAK', cleanup)
}