From 9815f9a5a1fa5fce6c6e2a62dc4d376a27aaa5ee Mon Sep 17 00:00:00 2001 From: Benedict Aas Date: Fri, 27 Oct 2017 19:42:57 +0100 Subject: [PATCH] fix: set debug env variable on remote electron process (#1789) We fix the DEBUG environment variable by setting it on the `electron.remote` instead, and we also move the code to `lib/gui/app.js` and away from `lib/gui/index.html`. Changelog-Entry: Set the DEBUG environment variable on the remote electron process. Change-Type: patch * use debug.enabled, fix drivelist env setting * fix: set debug env variable on remote electron process --- lib/gui/app.js | 8 ++++++++ lib/gui/index.html | 10 ---------- lib/shared/sdk/usbboot/index.js | 2 ++ lib/start.js | 2 -- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/gui/app.js b/lib/gui/app.js index ddb22481..9bf9a3a2 100644 --- a/lib/gui/app.js +++ b/lib/gui/app.js @@ -47,6 +47,14 @@ const driveScanner = require('./modules/drive-scanner') const osDialog = require('./os/dialog') const exceptionReporter = require('./modules/exception-reporter') +// Enable debug information from all modules that use `debug` +// See https://github.com/visionmedia/debug#browser-support +// +// Enable drivelist debugging information +// See https://github.com/resin-io-modules/drivelist +electron.remote.process.env.DRIVELIST_DEBUG = /drivelist|^\*$/i.test(electron.remote.process.env.DEBUG) ? '1' : '' +window.localStorage.debug = electron.remote.process.env.DEBUG + const app = angular.module('Etcher', [ require('angular-ui-router'), require('angular-ui-bootstrap'), diff --git a/lib/gui/index.html b/lib/gui/index.html index 7dd88d0a..0df2d1b2 100644 --- a/lib/gui/index.html +++ b/lib/gui/index.html @@ -6,16 +6,6 @@ - - - - - diff --git a/lib/shared/sdk/usbboot/index.js b/lib/shared/sdk/usbboot/index.js index efa895b8..cd55b0b2 100644 --- a/lib/shared/sdk/usbboot/index.js +++ b/lib/shared/sdk/usbboot/index.js @@ -31,6 +31,8 @@ const utils = require('../../utils') debug.enabled = true +debug.enabled = true + /** * @summary The radix used by USB ID numbers * @type {Number} diff --git a/lib/start.js b/lib/start.js index e535cdf3..07497858 100644 --- a/lib/start.js +++ b/lib/start.js @@ -16,8 +16,6 @@ 'use strict' -process.env.DEBUG = `sdk:usbboot,${process.env.DEBUG}` - // See http://electron.atom.io/docs/v0.37.7/api/environment-variables/#electronrunasnode // // Notice that if running electron with `ELECTRON_RUN_AS_NODE`, the binary