{"action":"created","issue":{"url":"https://api.github.com/repos/Squirrel/Squirrel.Windows/issues/446","labels_url":"https://api.github.com/repos/Squirrel/Squirrel.Windows/issues/446/labels{/name}","comments_url":"https://api.github.com/repos/Squirrel/Squirrel.Windows/issues/446/comments","events_url":"https://api.github.com/repos/Squirrel/Squirrel.Windows/issues/446/events","html_url":"https://github.com/Squirrel/Squirrel.Windows/issues/446","id":108111108,"number":446,"title":"When I'm updating the Electron app in the background the main window pops up for a second.","user":{"login":"lipis","id":125676,"avatar_url":"https://avatars.githubusercontent.com/u/125676?v=3","gravatar_id":"","url":"https://api.github.com/users/lipis","html_url":"https://github.com/lipis","followers_url":"https://api.github.com/users/lipis/followers","following_url":"https://api.github.com/users/lipis/following{/other_user}","gists_url":"https://api.github.com/users/lipis/gists{/gist_id}","starred_url":"https://api.github.com/users/lipis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lipis/subscriptions","organizations_url":"https://api.github.com/users/lipis/orgs","repos_url":"https://api.github.com/users/lipis/repos","events_url":"https://api.github.com/users/lipis/events{/privacy}","received_events_url":"https://api.github.com/users/lipis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-24T11:20:23Z","updated_at":"2015-09-24T18:43:11Z","closed_at":null,"body":"I'm using Electron and the this [Grunt task](https://github.com/atom/grunt-electron-installer) to make releases. Everything works perfectly fine and the updates are happening in the background, but during that update a second application's window pops up for a brief moment and then closes. Is there any way to avoid that somehow?"},"comment":{"url":"https://api.github.com/repos/Squirrel/Squirrel.Windows/issues/comments/143015915","html_url":"https://github.com/Squirrel/Squirrel.Windows/issues/446#issuecomment-143015915","issue_url":"https://api.github.com/repos/Squirrel/Squirrel.Windows/issues/446","id":143015915,"user":{"login":"paulcbetts","id":1396,"avatar_url":"https://avatars.githubusercontent.com/u/1396?v=3","gravatar_id":"","url":"https://api.github.com/users/paulcbetts","html_url":"https://github.com/paulcbetts","followers_url":"https://api.github.com/users/paulcbetts/followers","following_url":"https://api.github.com/users/paulcbetts/following{/other_user}","gists_url":"https://api.github.com/users/paulcbetts/gists{/gist_id}","starred_url":"https://api.github.com/users/paulcbetts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulcbetts/subscriptions","organizations_url":"https://api.github.com/users/paulcbetts/orgs","repos_url":"https://api.github.com/users/paulcbetts/repos","events_url":"https://api.github.com/users/paulcbetts/events{/privacy}","received_events_url":"https://api.github.com/users/paulcbetts/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T18:43:11Z","updated_at":"2015-09-24T18:43:11Z","body":"Here's what Slack does:\r\n\r\n```js\r\n// Private: When our app is installed, Squirrel (our app install/update framework)\r\n// invokes our executable with specific parameters, usually of the form\r\n// '--squirrel-$EVENT $VERSION' (i.e. '--squirrel-install 0.1.0'). This is our\r\n// chance to do custom install / uninstall actions. Once these events are handled,\r\n// we **must** exit imediately\r\n//\r\n// appStart - A callback to be invoked to start the application if there are no\r\n//            Squirrel events to handle.\r\n//\r\n// Returns a {Promise} whose value is a Boolean - if 'true', start the app. If\r\n// 'false', quit immediately.\r\nasync function handleSquirrelEvents() {\r\n  let options = process.argv.slice(1);\r\n\r\n  if (!(options && options.length >= 1)) {\r\n    return true;\r\n  }\r\n\r\n  let m = options[0].match(/--squirrel-([a-z]+)/);\r\n  if (!(m && m[1])) {\r\n    return true;\r\n  }\r\n\r\n  if (m[1] === 'firstrun') {\r\n    return true;\r\n  }\r\n\r\n  let appIsReady = new Promise((resolve) => {\r\n    app.on('ready', () => resolve(true));\r\n  });\r\n\r\n  await appIsReady;\r\n\r\n  let defaultLocations = 'Desktop,StartMenu,Startup';\r\n\r\n  // NB: Babel currently hates switch + await, /shrug\r\n  if (m[1] === 'install') {\r\n    await createShortcuts(defaultLocations);\r\n  }\r\n\r\n  if (m[1] === 'updated') {\r\n    await updateShortcuts(defaultLocations);\r\n  }\r\n\r\n  if (m[1] === 'uninstall') {\r\n    await removeShortcuts(defaultLocations);\r\n\r\n    let taskKill = path.join(process.env.SYSTEMROOT, 'system32', 'taskkill.exe');\r\n    let args = ['/F', '/IM', 'slack.exe', '/T'];\r\n    await spawn(taskKill, args);\r\n  }\r\n\r\n  return false;\r\n}\r\n\r\n// Go go go go go go go\r\nhandleSquirrelEvents()\r\n  .then((shouldRun) => {\r\n    if (!shouldRun) {\r\n      app.quit();\r\n      process.exit(0);\r\n    }\r\n\r\n    start();\r\n  })\r\n  .catch((e) => {\r\n    console.log(`Inevitable Demise! ${e.message}`);\r\n    console.log(e.stack);\r\n\r\n    app.quit();\r\n    process.exit(0);\r\n  });\r\n```"}}