Close all windows before installing update.
This commit is contained in:
parent
93687efee9
commit
6b3ff63358
2 changed files with 21 additions and 0 deletions
|
@ -8,4 +8,15 @@ autoUpdater.on 'update-downloaded-raw', (args...) ->
|
||||||
args[3] = new Date(args[3]) # releaseDate
|
args[3] = new Date(args[3]) # releaseDate
|
||||||
@emit 'update-downloaded', args..., => @quitAndInstall()
|
@emit 'update-downloaded', args..., => @quitAndInstall()
|
||||||
|
|
||||||
|
autoUpdater.quitAndInstall = ->
|
||||||
|
# Do the restart after all windows have been closed.
|
||||||
|
app = require 'app'
|
||||||
|
app.removeAllListeners 'window-all-closed'
|
||||||
|
app.once 'window-all-closed', AutoUpdater::quitAndInstall.bind(this)
|
||||||
|
|
||||||
|
# Tell all windows to remove beforeunload handler and then close itself.
|
||||||
|
ipc = require 'ipc'
|
||||||
|
BrowserWindow = require 'browser-window'
|
||||||
|
ipc.sendChannel win.getProcessId(), win.getRoutingId(), 'ATOM_SHELL_SILENT_CLOSE' for win in BrowserWindow.getAllWindows()
|
||||||
|
|
||||||
module.exports = autoUpdater
|
module.exports = autoUpdater
|
||||||
|
|
|
@ -50,6 +50,16 @@ window.onerror = (error) ->
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
|
|
||||||
|
# Enable browser to close window silently.
|
||||||
|
setTimeout ->
|
||||||
|
require('ipc').once 'ATOM_SHELL_SILENT_CLOSE', ->
|
||||||
|
window.onbeforeunload = null
|
||||||
|
window.close()
|
||||||
|
|
||||||
|
# Override default window.close.
|
||||||
|
window.close = ->
|
||||||
|
require('remote').getCurrentWindow().close()
|
||||||
|
|
||||||
# Override default window.open.
|
# Override default window.open.
|
||||||
window.open = (url, name, features) ->
|
window.open = (url, name, features) ->
|
||||||
options = {}
|
options = {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue