From 1f080569777368bc792405431f9985b32e83a30f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 12 Jun 2023 23:28:54 +0200 Subject: [PATCH] extensionSystem: Remove "disable" file on shutdown The file indicates to the systemd shutdown scripts that extensions should be disabled, so that extensions that crash the shell on startup cannot lock out the user indefinitely. For that purpose, we create the file before initializing extensions, and remove it after 60 seconds. That generally works, because it's highly unlikely that a session genuinely ends within the first minute. It's possible though (for example during developments or when running tests), so also remove the file when shutting down cleanly before the timeout. Part-of: --- js/ui/extensionSystem.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js index 84c85f042..222ac05ed 100644 --- a/js/ui/extensionSystem.js +++ b/js/ui/extensionSystem.js @@ -57,7 +57,12 @@ var ExtensionManager = class extends Signals.EventEmitter { log(`Failed to create file ${disableFilename}: ${e.message}`); } + const shutdownId = global.connect('shutdown', + () => disableFile.delete(null)); + GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 60, () => { + global.context.disconnect(shutdownId); + disableFile.delete(null); return GLib.SOURCE_REMOVE; });