From 1dba6d155b546d4b7439a9513607aa3668b185f7 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Fri, 20 Sep 2024 15:33:30 +0800 Subject: [PATCH] TerminalShell (Linux): improve performance of foot version detection --- src/detection/terminalshell/terminalshell.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index c44ecc32c..05cf9c4ca 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -365,6 +365,13 @@ FF_MAYBE_UNUSED static bool getTerminalVersionKonsole(FFstrbuf* exe, FFstrbuf* v FF_MAYBE_UNUSED static bool getTerminalVersionFoot(FFstrbuf* exe, FFstrbuf* version) { + uint32_t major = 0, minor = 0, patch = 0; + if (ffGetTerminalResponse("\e[>c", 3, "\e[>1;%2u%2u%2u;0c", &major, &minor, &patch) == NULL) + { + ffStrbufSetF(version, "%u.%u.%u", major, minor, patch); + return true; + } + if(!getExeVersionRaw(exe, version)) return false; //foot version: 1.13.1 -pgo +ime -graphemes -assertions