{"action":"created","issue":{"url":"https://api.github.com/repos/atom/electron/issues/2208","labels_url":"https://api.github.com/repos/atom/electron/issues/2208/labels{/name}","comments_url":"https://api.github.com/repos/atom/electron/issues/2208/comments","events_url":"https://api.github.com/repos/atom/electron/issues/2208/events","html_url":"https://github.com/atom/electron/issues/2208","id":94812278,"number":2208,"title":"Spawning a detached process/unref()ing it doesn't work on Linux","user":{"login":"shrewdlogarithm","id":4963937,"avatar_url":"https://avatars.githubusercontent.com/u/4963937?v=3","gravatar_id":"","url":"https://api.github.com/users/shrewdlogarithm","html_url":"https://github.com/shrewdlogarithm","followers_url":"https://api.github.com/users/shrewdlogarithm/followers","following_url":"https://api.github.com/users/shrewdlogarithm/following{/other_user}","gists_url":"https://api.github.com/users/shrewdlogarithm/gists{/gist_id}","starred_url":"https://api.github.com/users/shrewdlogarithm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shrewdlogarithm/subscriptions","organizations_url":"https://api.github.com/users/shrewdlogarithm/orgs","repos_url":"https://api.github.com/users/shrewdlogarithm/repos","events_url":"https://api.github.com/users/shrewdlogarithm/events{/privacy}","received_events_url":"https://api.github.com/users/shrewdlogarithm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-07-13T21:09:12Z","updated_at":"2015-07-14T23:59:49Z","closed_at":null,"body":"This is tested on the 0.29.2 Linux32 build.\r\n\r\nI have something like this in my main.js\r\n\r\n`var child = child_process.spawn(exepath, [], {detached: true});`\r\n`child.unref();`\r\n`console.log(\"quitting\")`\r\n`app.quit()`\r\n\r\nI also have code which outputs when \"before-quit\", \"will-quit\" and \"quit\" events fire.\r\n\r\nThe exe being called takes a while to run - on Windows, it runs whilst Electron closes down - on Linux however, Electron doesn't seem to close AT ALL - not even when the spawned process completes (e.g. I suspect it's hitting an error?)\r\n\r\nI get the \"quitting\" message (so the spawn isn't failed - the process runs), I then get messages from \"before-quit\", \"will-quit\" and \"quit\" - but the app continues to run (it's tray icon doesn't disappear and it's still in \"ps\")\r\n\r\nAny ideas - anything I can do to debug this further?"},"comment":{"url":"https://api.github.com/repos/atom/electron/issues/comments/121431704","html_url":"https://github.com/atom/electron/issues/2208#issuecomment-121431704","issue_url":"https://api.github.com/repos/atom/electron/issues/2208","id":121431704,"user":{"login":"Mingling94","id":4606838,"avatar_url":"https://avatars.githubusercontent.com/u/4606838?v=3","gravatar_id":"","url":"https://api.github.com/users/Mingling94","html_url":"https://github.com/Mingling94","followers_url":"https://api.github.com/users/Mingling94/followers","following_url":"https://api.github.com/users/Mingling94/following{/other_user}","gists_url":"https://api.github.com/users/Mingling94/gists{/gist_id}","starred_url":"https://api.github.com/users/Mingling94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mingling94/subscriptions","organizations_url":"https://api.github.com/users/Mingling94/orgs","repos_url":"https://api.github.com/users/Mingling94/repos","events_url":"https://api.github.com/users/Mingling94/events{/privacy}","received_events_url":"https://api.github.com/users/Mingling94/received_events","type":"User","site_admin":false},"created_at":"2015-07-14T23:59:49Z","updated_at":"2015-07-14T23:59:49Z","body":"Hmm, this is an interesting dilemma and may be electron related. In my own project, I spawn the detached child_process from a renderer process instead of the main. I can close my app while the child runs in the background fine enough. This would be on Ubuntu 14.04 64 bit though.\r\n\r\nCheck if the renderer process starting said process still behaves in this odd way on your system.\r\n\r\nLastly, it could be some unexpected `beforeunload` or `unload` handler, see [this part of the documentation](https://github.com/atom/electron/blob/master/docs/api/app.md#appquit)"}}