{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/6477","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/6477/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/6477/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/6477/events","html_url":"https://github.com/nodejs/node/pull/6477","id":151933026,"number":6477,"title":"process: add process.exitSoon()","user":{"login":"jasnell","id":439929,"avatar_url":"https://avatars.githubusercontent.com/u/439929?v=3","gravatar_id":"","url":"https://api.github.com/users/jasnell","html_url":"https://github.com/jasnell","followers_url":"https://api.github.com/users/jasnell/followers","following_url":"https://api.github.com/users/jasnell/following{/other_user}","gists_url":"https://api.github.com/users/jasnell/gists{/gist_id}","starred_url":"https://api.github.com/users/jasnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasnell/subscriptions","organizations_url":"https://api.github.com/users/jasnell/orgs","repos_url":"https://api.github.com/users/jasnell/repos","events_url":"https://api.github.com/users/jasnell/events{/privacy}","received_events_url":"https://api.github.com/users/jasnell/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/in%20progress","name":"in progress","color":"ededed"},{"url":"https://api.github.com/repos/nodejs/node/labels/process","name":"process","color":"00aaff"},{"url":"https://api.github.com/repos/nodejs/node/labels/semver-minor","name":"semver-minor","color":"fef2c0"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":28,"created_at":"2016-04-29T17:56:05Z","updated_at":"2016-04-30T02:22:04Z","closed_at":"2016-04-30T00:06:48Z","pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/6477","html_url":"https://github.com/nodejs/node/pull/6477","diff_url":"https://github.com/nodejs/node/pull/6477.diff","patch_url":"https://github.com/nodejs/node/pull/6477.patch"},"body":"##### Checklist\r\n\r\n- [ ] tests and code linting passes\r\n- [ ] a test and/or benchmark is included\r\n- [ ] documentation is changed or added\r\n- [ ] the commit message follows commit guidelines\r\n\r\n##### Affected core subsystem(s)\r\n\r\nprocess\r\n\r\n##### Description of change\r\n\r\nUpdated: adds process.exitSoon([code[, timeout]]) and `'exitingSoon'` event to process. Allows exitingSoon handlers to defer exit until they are ready. Timer is optional.\r\n\r\n~~When set, an internal timer will be set that will exit the process at the given timeout. In the meantime, the registered listeners for process.on('exitingSoon') will be invoked and passed a callback to be called when the handler is ready for the process to exit. The process will exit either when the internal timer fires or all the callbacks are called, whichever comes first.~~\r\n\r\nThis is an attempt to deal more intelligently with resource cleanup and async op completion on exit\r\n\r\nDocs / test case included\r\n\r\nRefs: https://github.com/nodejs/node/issues/6456"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/215926051","html_url":"https://github.com/nodejs/node/pull/6477#issuecomment-215926051","issue_url":"https://api.github.com/repos/nodejs/node/issues/6477","id":215926051,"user":{"login":"kzc","id":11593452,"avatar_url":"https://avatars.githubusercontent.com/u/11593452?v=3","gravatar_id":"","url":"https://api.github.com/users/kzc","html_url":"https://github.com/kzc","followers_url":"https://api.github.com/users/kzc/followers","following_url":"https://api.github.com/users/kzc/following{/other_user}","gists_url":"https://api.github.com/users/kzc/gists{/gist_id}","starred_url":"https://api.github.com/users/kzc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kzc/subscriptions","organizations_url":"https://api.github.com/users/kzc/orgs","repos_url":"https://api.github.com/users/kzc/repos","events_url":"https://api.github.com/users/kzc/events{/privacy}","received_events_url":"https://api.github.com/users/kzc/received_events","type":"User","site_admin":false},"created_at":"2016-04-30T02:22:04Z","updated_at":"2016-04-30T02:22:04Z","body":"@jasnell Thanks for exploring this design. It was a useful exercise. Without the event loop what actions you can perform in a shutdown hook are very limited. This is a deceptively difficult problem. I don't know how to solve it other than the way `node-exit` did it."}}