mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Add restart helper on Windows
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
{EventEmitter} = require 'events'
|
||||
_ = require 'underscore-plus'
|
||||
shellAutoUpdater = require 'auto-updater'
|
||||
SquirrelUpdate = require './squirrel-update'
|
||||
|
||||
class AutoUpdater
|
||||
@@ -12,11 +11,9 @@ class AutoUpdater
|
||||
console.log 'restarting new atom.exe'
|
||||
|
||||
if SquirrelUpdate.existsSync()
|
||||
SquirrelUpdate.spawn ['--processStart', 'atom.exe'], ->
|
||||
console.log 'spawned new atom.exe'
|
||||
shellAutoUpdater.quitAndInstall()
|
||||
SquirrelUpdate.restartAtom()
|
||||
else
|
||||
shellAutoUpdater.quitAndInstall()
|
||||
require('auto-updater').quitAndInstall()
|
||||
|
||||
downloadUpdate: (callback) ->
|
||||
SquirrelUpdate.spawn ['--download', @updateUrl], (error, stdout) ->
|
||||
|
||||
@@ -36,7 +36,7 @@ spawn = (command, args, callback) ->
|
||||
error ?= new Error("Command failed: #{signal ? code}") if code isnt 0
|
||||
error?.code ?= code
|
||||
error?.stdout ?= stdout
|
||||
callback(error, stdout)
|
||||
callback?(error, stdout)
|
||||
|
||||
# Spawn reg.exe and callback when it completes
|
||||
spawnReg = (args, callback) ->
|
||||
@@ -175,6 +175,11 @@ exports.spawn = spawnUpdate
|
||||
exports.existsSync = ->
|
||||
fs.existsSync(updateDotExe)
|
||||
|
||||
# Restart Atom using the version pointed to by the atom.cmd shim
|
||||
exports.restartAtom = ->
|
||||
app.once 'will-quit', -> spawn(path.join(binFolder, 'atom.cmd'))
|
||||
app.quit()
|
||||
|
||||
# Handle squirrel events denoted by --squirrel-* command line arguments.
|
||||
exports.handleStartupEvent = ->
|
||||
switch process.argv[1]
|
||||
|
||||
Reference in New Issue
Block a user