From 6e4b725da5ae9e6a051b0ad6740e03d675c52a6b Mon Sep 17 00:00:00 2001 From: Anthony Tseng Date: Tue, 7 Nov 2017 21:22:47 -0800 Subject: [PATCH] Correct relaunch logic fix #11821 fix #11824 Auditors: @bsclifton Test Plan: a. CHANNEL=beta npm start shouldn't relaunch b. CHANNEL=beta npm build-package b-1. ./BraveBeta-win32-x64/BraveBeta.exe should relaunch and use `brave-beta` as user dir b-2 CHANNEL=beta npm build-installer b-3 Install Brave by dist/x64/BraveBeta-Setup-x64.exe b-4 After installation, the first time launch should relaunch and use `brave-beta` as user dir --- app/windowsInit.js | 9 ++++++--- tools/buildInstaller.js | 4 +--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/windowsInit.js b/app/windowsInit.js index 1a0a9efc029..d4dac467310 100644 --- a/app/windowsInit.js +++ b/app/windowsInit.js @@ -76,13 +76,16 @@ if (process.platform === 'win32') { } const userDataDirSwitch = '--user-data-dir-name=brave-' + channel - if (channel && channel !== 'dev' && !process.argv.includes(userDataDirSwitch)) { + if (channel !== 'dev' && !process.argv.includes(userDataDirSwitch) && + !process.argv.includes('--relaunch') && + !process.argv.includes('--user-data-dir-name=brave-development')) { + delete process.env.CHROME_USER_DATA_DIR if (cmd === '--squirrel-firstrun') { app.relaunch({args: [userDataDirSwitch, '--relaunch']}) } else { - app.relaunch({args: process.argv.slice(1) + [userDataDirSwitch, '--relaunch']}) + app.relaunch({args: process.argv.slice(1).concat([userDataDirSwitch, '--relaunch'])}) } - app.quit() + app.exit() } } diff --git a/tools/buildInstaller.js b/tools/buildInstaller.js index 084d095eabc..d5e92c017ee 100644 --- a/tools/buildInstaller.js +++ b/tools/buildInstaller.js @@ -178,9 +178,7 @@ if (isDarwin) { setupExe: `${appName}-Setup-${arch}.exe` }) resultPromise.then(() => { - cmds = [ - ] - execute(cmds, {}, console.log.bind(null, 'done')) + console.log('done') }, (e) => console.log(`No dice: ${e.message}`)) }) } else if (isLinux) {