Π·Π΅ΡΠΊΠ°Π»ΠΎ ΠΈΠ· https://github.com/Unity-Technologies/electron.git
π§ Sprinkle some ES6 across the file
This commit is contained in:
Π ΠΎΠ΄ΠΈΡΠ΅Π»Ρ
c5abe96b39
ΠΠΎΠΌΠΌΠΈΡ
9646f0c99a
|
@ -8,19 +8,15 @@ const appFolder = path.dirname(process.execPath)
|
|||
// i.e. my-app/Update.exe
|
||||
const updateExe = path.resolve(appFolder, '..', 'Update.exe')
|
||||
const exeName = path.basename(process.execPath)
|
||||
var spawnedArgs = []
|
||||
var spawnedProcess
|
||||
let spawnedArgs = []
|
||||
let spawnedProcess
|
||||
|
||||
var isSameArgs = function (args) {
|
||||
return (args.length === spawnedArgs.length) && args.every(function (e, i) {
|
||||
return e === spawnedArgs[i]
|
||||
})
|
||||
}
|
||||
const isSameArgs = (args) => args.length === spawnedArgs.length && args.every((e, i) => e === spawnedArgs[i])
|
||||
|
||||
// Spawn a command and invoke the callback when it completes with an error
|
||||
// and the output from standard out.
|
||||
var spawnUpdate = function (args, detached, callback) {
|
||||
var error, errorEmitted, stderr, stdout
|
||||
let spawnUpdate = function (args, detached, callback) {
|
||||
let error, errorEmitted, stderr, stdout
|
||||
|
||||
try {
|
||||
// Ensure we don't spawn multiple squirrel processes
|
||||
|
@ -33,7 +29,6 @@ var spawnUpdate = function (args, detached, callback) {
|
|||
return callback(`AutoUpdater process with arguments ${args} is already running`)
|
||||
} else if (!spawnedProcess) {
|
||||
spawnedProcess = spawn(updateExe, args, {
|
||||
detached: detached
|
||||
detached: detached,
|
||||
windowsHide: true
|
||||
})
|
||||
|
@ -50,17 +45,16 @@ var spawnUpdate = function (args, detached, callback) {
|
|||
}
|
||||
stdout = ''
|
||||
stderr = ''
|
||||
spawnedProcess.stdout.on('data', function (data) {
|
||||
stdout += data
|
||||
})
|
||||
spawnedProcess.stderr.on('data', function (data) {
|
||||
stderr += data
|
||||
})
|
||||
|
||||
spawnedProcess.stdout.on('data', (data) => { stdout += data })
|
||||
spawnedProcess.stderr.on('data', (data) => { stderr += data })
|
||||
|
||||
errorEmitted = false
|
||||
spawnedProcess.on('error', function (error) {
|
||||
spawnedProcess.on('error', (error) => {
|
||||
errorEmitted = true
|
||||
callback(error)
|
||||
})
|
||||
|
||||
return spawnedProcess.on('exit', function (code, signal) {
|
||||
spawnedProcess = undefined
|
||||
spawnedArgs = []
|
||||
|
|
ΠΠ°Π³ΡΡΠ·ΠΊΠ°β¦
Π‘ΡΡΠ»ΠΊΠ° Π² Π½ΠΎΠ²ΠΎΠΉ Π·Π°Π΄Π°ΡΠ΅