mirror of https://github.com/docker/docs.git
Merge pull request #1394 from alexandrev/issue-1369
Fix stop the machine on close on Windows
This commit is contained in:
commit
e8098e6e5e
|
|
@ -6,13 +6,14 @@ import fs from 'fs';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import child_process from 'child_process';
|
import child_process from 'child_process';
|
||||||
|
let Promise = require('bluebird');
|
||||||
|
|
||||||
process.env.NODE_PATH = path.join(__dirname, 'node_modules');
|
process.env.NODE_PATH = path.join(__dirname, 'node_modules');
|
||||||
process.env.RESOURCES_PATH = path.join(__dirname, '/../resources');
|
process.env.RESOURCES_PATH = path.join(__dirname, '/../resources');
|
||||||
if (process.platform !== 'win32') {
|
if (process.platform !== 'win32') {
|
||||||
process.env.PATH = '/usr/local/bin:' + process.env.PATH;
|
process.env.PATH = '/usr/local/bin:' + process.env.PATH;
|
||||||
}
|
}
|
||||||
|
var exiting = false;
|
||||||
var size = {}, settingsjson = {};
|
var size = {}, settingsjson = {};
|
||||||
try {
|
try {
|
||||||
size = JSON.parse(fs.readFileSync(path.join(app.getPath('userData'), 'size')));
|
size = JSON.parse(fs.readFileSync(path.join(app.getPath('userData'), 'size')));
|
||||||
|
|
@ -49,9 +50,15 @@ app.on('ready', function () {
|
||||||
|
|
||||||
|
|
||||||
if (os.platform() === 'win32') {
|
if (os.platform() === 'win32') {
|
||||||
mainWindow.on('close', function () {
|
mainWindow.on('close', function (e) {
|
||||||
mainWindow.webContents.send('application:quitting');
|
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 () {
|
app.on('window-all-closed', function () {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue