From 88857c80e94faae1c6a8243d90ac669af4de5677 Mon Sep 17 00:00:00 2001 From: Reef Turner Date: Wed, 23 Jun 2021 20:08:30 +0800 Subject: [PATCH] Fix auto update (PR #12575) * Revert "Maintain logging level on restart" This reverts commit 76b2aeaa There were several issues with this commit: - a missing space before "--log-level=" in updateCheck.py caused automatic updates to fail. - explicitly setting the log level prevents the log level from being manually set in the General settings panel. This is a change in behavior and needs to be considered more carefully. See usages of logHandler.isLogLevelForced() * Log unsafe restart * Add reasoning about including any existing params when doing an unsafe restart. This provides different behavior from def restart() --- source/core.py | 6 +++++- source/gui/installerGui.py | 2 -- source/updateCheck.py | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/core.py b/source/core.py index 7a1e0356816..630284f4483 100644 --- a/source/core.py +++ b/source/core.py @@ -133,8 +133,12 @@ def restartUnsafely(): - Remove icons (systray) - Saving settings """ - + log.info("Restarting unsafely") import subprocess + # Unlike a normal restart, see L{restart}: + # - if addons are disabled, leave them disabled + # - if debug logging is set, leave it set. + # The new instance should operate in the same way (as much as possible) as the old instance. for paramToRemove in ("--ease-of-access"): try: sys.argv.remove(paramToRemove) diff --git a/source/gui/installerGui.py b/source/gui/installerGui.py index ba54138d639..d79a0a0bc3a 100644 --- a/source/gui/installerGui.py +++ b/source/gui/installerGui.py @@ -114,7 +114,6 @@ def doInstall( if startAfterInstall: newNVDA = core.NewNVDAInstance( filePath=os.path.join(installer.defaultInstallPath, 'nvda.exe'), - parameters=f"--log-level={log.level}" ) if not core.triggerNVDAExit(newNVDA): log.error("NVDA already in process of exiting, this indicates a logic error.") @@ -473,7 +472,6 @@ def doCreatePortable(portableDirectory,copyUserConfig=False,silent=False,startAf if startAfterCreate: newNVDA = core.NewNVDAInstance( filePath=os.path.join(portableDirectory, 'nvda.exe'), - parameters=f"--log-level={log.level}" ) if not core.triggerNVDAExit(newNVDA): log.error("NVDA already in process of exiting, this indicates a logic error.") diff --git a/source/updateCheck.py b/source/updateCheck.py index 7a88705a982..96bbc2b4092 100644 --- a/source/updateCheck.py +++ b/source/updateCheck.py @@ -220,7 +220,6 @@ def _executeUpdate(destPath): ) else: executeParams = u"--launcher" - executeParams += f"--log-level={log.level}" # #4475: ensure that the new process shows its first window, by providing SW_SHOWNORMAL if not core.triggerNVDAExit(core.NewNVDAInstance(destPath, executeParams)): log.error("NVDA already in process of exiting, this indicates a logic error.")