diff --git a/lib/browser/init.js b/lib/browser/init.js index f7619fd17ba..6ff328830e5 100644 --- a/lib/browser/init.js +++ b/lib/browser/init.js @@ -39,14 +39,6 @@ if (process.platform === 'win32') { } console.log = console.error = console.warn = consoleLog process.stdout.write = process.stderr.write = streamWrite - - // Always returns EOF for stdin stream. - var Readable = require('stream').Readable - var stdin = new Readable() - stdin.push(null) - process.__defineGetter__('stdin', function () { - return stdin - }) } // Don't quit on fatal error. diff --git a/lib/common/init.js b/lib/common/init.js index 257249f0a63..0ffd97a7c53 100644 --- a/lib/common/init.js +++ b/lib/common/init.js @@ -38,11 +38,21 @@ if (process.type === 'browser') { global.setInterval = wrapWithActivateUvLoop(timers.setInterval) } -// If we're running as a Windows Store app, __dirname will be set -// to C:/Program Files/WindowsApps. -// -// Nobody else get's to install there, changing the path is forbidden -// We can therefore say that we're running as appx -if (process.platform === 'win32' && __dirname.indexOf('\\Program Files\\WindowsApps\\') === 2) { - process.windowsStore = true +if (process.platform === 'win32') { + // Always returns EOF for stdin stream. + const {Readable} = require('stream') + const stdin = new Readable() + stdin.push(null) + process.__defineGetter__('stdin', function () { + return stdin + }) + + // If we're running as a Windows Store app, __dirname will be set + // to C:/Program Files/WindowsApps. + // + // Nobody else get's to install there, changing the path is forbidden + // We can therefore say that we're running as appx + if (__dirname.indexOf('\\Program Files\\WindowsApps\\') === 2) { + process.windowsStore = true + } }