Only support ELECTRON_NO_ASAR in non browser/renderer processes

This commit is contained in:
Kevin Sawicki 2016-10-07 10:59:34 -07:00
parent 8897a7a926
commit f553d16539
2 changed files with 12 additions and 2 deletions

View file

@ -10,6 +10,16 @@
// Cache asar archive objects. // Cache asar archive objects.
const cachedArchives = {} const cachedArchives = {}
const isAsarDisabled = function () {
if (process.noAsar) {
return true
}
if (process.env.ELECTRON_NO_ASAR && process.type !== 'browser' && process.type !== 'renderer') {
return true
}
return false
}
const getOrCreateArchive = function (p) { const getOrCreateArchive = function (p) {
let archive = cachedArchives[p] let archive = cachedArchives[p]
if (archive != null) { if (archive != null) {
@ -34,7 +44,7 @@
// Separate asar package's path from full path. // Separate asar package's path from full path.
const splitPath = function (p) { const splitPath = function (p) {
// shortcut to disable asar. // shortcut to disable asar.
if (process.noAsar || process.env.ELECTRON_NO_ASAR) { if (isAsarDisabled()) {
return [false] return [false]
} }

View file

@ -781,7 +781,7 @@ describe('asar package', function () {
output += data output += data
}) })
spawned.stdout.on('close', function () { spawned.stdout.on('close', function () {
stats = JSON.parse(output) const stats = JSON.parse(output)
assert.equal(stats.isFile, true) assert.equal(stats.isFile, true)
assert.equal(stats.size, 778) assert.equal(stats.size, 778)
done() done()