From f553d165399007266c2d0cfea2af1c86fcb45737 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 7 Oct 2016 10:59:34 -0700 Subject: [PATCH] Only support ELECTRON_NO_ASAR in non browser/renderer processes --- lib/common/asar.js | 12 +++++++++++- spec/asar-spec.js | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/common/asar.js b/lib/common/asar.js index 42510119841a..0891669f801a 100644 --- a/lib/common/asar.js +++ b/lib/common/asar.js @@ -10,6 +10,16 @@ // Cache asar archive objects. 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) { let archive = cachedArchives[p] if (archive != null) { @@ -34,7 +44,7 @@ // Separate asar package's path from full path. const splitPath = function (p) { // shortcut to disable asar. - if (process.noAsar || process.env.ELECTRON_NO_ASAR) { + if (isAsarDisabled()) { return [false] } diff --git a/spec/asar-spec.js b/spec/asar-spec.js index 8b5e741be176..5399cde041f6 100644 --- a/spec/asar-spec.js +++ b/spec/asar-spec.js @@ -781,7 +781,7 @@ describe('asar package', function () { output += data }) spawned.stdout.on('close', function () { - stats = JSON.parse(output) + const stats = JSON.parse(output) assert.equal(stats.isFile, true) assert.equal(stats.size, 778) done()