Merge pull request #1394 from alexandrev/issue-1369

Fix stop the machine on close on Windows
This commit is contained in:
French Ben 2016-05-09 14:47:21 -04:00
commit e8098e6e5e
1 changed files with 10 additions and 3 deletions

View File

@ -6,13 +6,14 @@ import fs from 'fs';
import os from 'os';
import path from 'path';
import child_process from 'child_process';
let Promise = require('bluebird');
process.env.NODE_PATH = path.join(__dirname, 'node_modules');
process.env.RESOURCES_PATH = path.join(__dirname, '/../resources');
if (process.platform !== 'win32') {
process.env.PATH = '/usr/local/bin:' + process.env.PATH;
}
var exiting = false;
var size = {}, settingsjson = {};
try {
size = JSON.parse(fs.readFileSync(path.join(app.getPath('userData'), 'size')));
@ -49,9 +50,15 @@ app.on('ready', function () {
if (os.platform() === 'win32') {
mainWindow.on('close', function () {
mainWindow.on('close', function (e) {
mainWindow.webContents.send('application:quitting');
return true;
if(!exiting){
Promise.delay(1000).then(function(){
mainWindow.close();
});
exiting = true;
e.preventDefault();
}
});
app.on('window-all-closed', function () {