mongodb-js / electron-squirrel-startup

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

Does app.quit() terminates the application immediately? #29

Open marcoancona opened 7 years ago

marcoancona commented 7 years ago

During the startup, I get

Uncaught Exception: Error: Cannot find module './mymodule' ...

The main.js looks like:

...
if (require('electron-squirrel-startup')) app.quit();
...
const Module = require('./mymodule'); 

Also, the event handling seems to take quite some time, like it the app was not actually closing immediately. The installation works fine though, and the app then works correctly when it is launched by the user.

Is the code after app.quit() executed? If so, shouldn't this be prevented somehow?

PS: this issue only appeared after upgrading to last version of electron and electron-squirrel

marcoancona commented 7 years ago

It seems that the issue is solved by using

app.quit();
process.exit(0);

instead of only app.quit().

See also https://github.com/Squirrel/Squirrel.Windows/issues/446