Linux build: Fix incorrect log output (#381)
Now we use a function closure to capture the `destArch` variable so the for loop can't change it.
This commit is contained in:
@@ -291,16 +291,26 @@ function buildWin32 (cb) {
|
||||
}
|
||||
|
||||
function buildLinux (packageType, cb) {
|
||||
var distPath = path.join(config.ROOT_PATH, 'dist')
|
||||
|
||||
electronPackager(Object.assign({}, all, linux), function (err, buildPath) {
|
||||
if (err) return cb(err)
|
||||
|
||||
var distPath = path.join(config.ROOT_PATH, 'dist')
|
||||
|
||||
for (var i = 0; i < buildPath.length; i++) {
|
||||
var filesPath = buildPath[i]
|
||||
var destArch = filesPath.split('-').pop()
|
||||
|
||||
if (packageType === 'deb' || packageType === 'all') {
|
||||
packageDeb(filesPath, destArch)
|
||||
}
|
||||
|
||||
if (packageType === 'zip' || packageType === 'all') {
|
||||
packageZip(filesPath, destArch)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function packageDeb (filesPath, destArch) {
|
||||
// Create .deb file for debian based platforms
|
||||
var deb = require('nobin-debian-installer')()
|
||||
var destPath = path.join('/opt', pkg.name)
|
||||
@@ -321,13 +331,13 @@ function buildLinux (packageType, cb) {
|
||||
dest: destPath,
|
||||
expand: true,
|
||||
cwd: filesPath
|
||||
}], function (err, done) {
|
||||
}], function (err) {
|
||||
if (err) return console.error(err.message || err)
|
||||
console.log('Created Linux ' + destArch + ' .deb file.')
|
||||
})
|
||||
}
|
||||
|
||||
if (packageType === 'zip' || packageType === 'all') {
|
||||
function packageZip (filesPath, destArch) {
|
||||
// Create .zip file for Linux
|
||||
var zipPath = path.join(config.ROOT_PATH, 'dist', BUILD_NAME + '-linux-' + destArch + '.zip')
|
||||
var appFolderName = path.basename(filesPath)
|
||||
@@ -335,8 +345,6 @@ function buildLinux (packageType, cb) {
|
||||
console.log('Created Linux ' + destArch + ' .zip file.')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function printDone (err, buildPath) {
|
||||
if (err) console.error(err.message || err)
|
||||
|
||||
Reference in New Issue
Block a user