mongodb-js / electron-squirrel-startup

Default Squirrel.Windows event handler for your Electron apps.
Apache License 2.0
217 stars 41 forks source link

Check if NO installer running? #16

Open MTRNord opened 7 years ago

MTRNord commented 7 years ago

How can I check if NO installer is running? Because when it runs the Autoupdater crash because there is an lock file.

ccnokes commented 7 years ago

This seems like a good enhancement.....not sure how it would be implemented though because basically the solution to that is to not autoUpdater.checkForUpdates when --squirrel-firstrun is in the app args (see https://github.com/electron/electron/issues/7155#issuecomment-245993316)

kuworking commented 7 years ago

Can it be done with electron-builder?

var autoUpdater = require('electron-auto-updater').autoUpdater;
let squirrelEvent = process.argv[1];
if (squirrelEvent !== '--squirrel-firstrun')
   autoUpdater.checkForUpdates();
develar commented 7 years ago

Electron-builder doesn't use Squirrel.windows by default.

kuworking commented 7 years ago

Then how can we detect the '--squirrel-firstrun' when using electron-builder?

develar commented 7 years ago

Please file issue to electron-builder and explain what do you want to achieve.

kuworking commented 7 years ago

It is the same issue asked here: How to avoid Autoupdater crashing when squirrel is doing its first run?

In order to avoid that we'd need to detect the --squirrel-firstrun flag, so in order to answer this question, we need to answer this other question: how can we detect the --squirrel-firstrun flag with Electron-builder?

If you suggest so I will open a separated issue, but in my eyes it would be redundant to this one

develar commented 7 years ago

If you can — just do not use Squirrel, default target for Windows is nsis.