{"action":"created","issue":{"url":"https://api.github.com/repos/segmentio/nightmare/issues/688","repository_url":"https://api.github.com/repos/segmentio/nightmare","labels_url":"https://api.github.com/repos/segmentio/nightmare/issues/688/labels{/name}","comments_url":"https://api.github.com/repos/segmentio/nightmare/issues/688/comments","events_url":"https://api.github.com/repos/segmentio/nightmare/issues/688/events","html_url":"https://github.com/segmentio/nightmare/issues/688","id":160817968,"number":688,"title":"Electron instances not destroyed","user":{"login":"AaronTrazona","id":1627816,"avatar_url":"https://avatars.githubusercontent.com/u/1627816?v=3","gravatar_id":"","url":"https://api.github.com/users/AaronTrazona","html_url":"https://github.com/AaronTrazona","followers_url":"https://api.github.com/users/AaronTrazona/followers","following_url":"https://api.github.com/users/AaronTrazona/following{/other_user}","gists_url":"https://api.github.com/users/AaronTrazona/gists{/gist_id}","starred_url":"https://api.github.com/users/AaronTrazona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AaronTrazona/subscriptions","organizations_url":"https://api.github.com/users/AaronTrazona/orgs","repos_url":"https://api.github.com/users/AaronTrazona/repos","events_url":"https://api.github.com/users/AaronTrazona/events{/privacy}","received_events_url":"https://api.github.com/users/AaronTrazona/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-06-17T06:03:14Z","updated_at":"2016-08-09T07:18:15Z","closed_at":null,"body":"I already called .end() function somehow there is a electron still running in the task.\r\nAnyone has a great idea how can i solve this issue? This issue bothering almost 1 month I can't find any solution.\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/segmentio/nightmare/issues/comments/238473332","html_url":"https://github.com/segmentio/nightmare/issues/688#issuecomment-238473332","issue_url":"https://api.github.com/repos/segmentio/nightmare/issues/688","id":238473332,"user":{"login":"voidmonk","id":84814,"avatar_url":"https://avatars.githubusercontent.com/u/84814?v=3","gravatar_id":"","url":"https://api.github.com/users/voidmonk","html_url":"https://github.com/voidmonk","followers_url":"https://api.github.com/users/voidmonk/followers","following_url":"https://api.github.com/users/voidmonk/following{/other_user}","gists_url":"https://api.github.com/users/voidmonk/gists{/gist_id}","starred_url":"https://api.github.com/users/voidmonk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voidmonk/subscriptions","organizations_url":"https://api.github.com/users/voidmonk/orgs","repos_url":"https://api.github.com/users/voidmonk/repos","events_url":"https://api.github.com/users/voidmonk/events{/privacy}","received_events_url":"https://api.github.com/users/voidmonk/received_events","type":"User","site_admin":false},"created_at":"2016-08-09T07:18:15Z","updated_at":"2016-08-09T07:18:15Z","body":"In my testing as well, I've noticed that if Nightmare is run in a service/daemon or HTTP server, Electron instances aren't killed by `nightmare.end()`. One workaround that works, is to disconnect & kill the child process explicitly (see code below):\r\n\r\n```node\r\n.then(function(result) {\r\n  // process the result\r\n})\r\n.catch(function(err) {\r\n  // handle any error\r\n})\r\n.then(_ => {\r\n  // finally cleanup\r\n  nightmare.end();\r\n  // kill the Electron process explicitly to ensure no orphan child processes\r\n  nightmare.proc.disconnect();\r\n  nightmare.proc.kill();\r\n  nightmare.ended = true;\r\n  nightmare = null;\r\n});\r\n```"}}
{"actor":{"display_login":"voidmonk"}}