[Windows 7] Close app - electron processes remain in task manager


#1

I’m on Windows 7 SP1, 64-bit. I’ve copied the dist folder from electron-prebuilt (0.27.3) and put my resources in the resouces/app folder. I’m not using an asar file for the resources at the moment.

Anyway, when I launch the app using electron.exe everything in the app itself is fine. I get three instances of electron.exe in task manager. When I close the app, only one of these disappears. If I open the app again, three more instances appear, an on closing only one disappears.

I did this a few times…

This is my index/main js file:

var app = require('app');
var BrowserWindow = require('browser-window');
var mainWindow;

app.on('ready', function () {
    mainWindow = new BrowserWindow({
        width: 800,
        height: 600
    });

    mainWindow.setMenuBarVisibility(false);
    mainWindow.maximize();

    mainWindow.loadUrl('file://' + __dirname + '/index.html');
});

I’ve not used electron before so apologies if I’m doing something stupid! Do I need to null vars on quit or something like that?

Thanks in advance for any help.


#2

I can’t test this right now but maybe you need to call app.quit().

// Quit when all windows are closed.
app.on('window-all-closed', function() {
  if (process.platform != 'darwin')
    app.quit();
});

http://electron.atom.io/docs/v0.27.0/tutorial/quick-start/#write-your-first-electron-app


#3

That’s fixed it, thanks very much!

That’ll teach me to follow a tutorial rather than use the quick start code… :weary: