From 23c8937362dee95af7b5c727b0ebc0f5b634cda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 2 Jul 2023 10:56:28 +0800 Subject: [PATCH] fix(Shell): fix shell version printing --- src/detection/terminalshell/terminalshell.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index d6a93d17a..7a72faff8 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -40,11 +40,17 @@ static bool getFileVersion(const char* exePath, FFstrbuf* version) static bool getExeVersionRaw(FFstrbuf* exe, FFstrbuf* version) { - return ffProcessAppendStdOut(version, (char* const[]) { + bool ok = ffProcessAppendStdOut(version, (char* const[]) { exe->chars, "--version", NULL }) == NULL; + if (ok) + { + ffStrbufTrim(version, '\n'); + ffStrbufTrim(version, ' '); + } + return ok; } static bool getExeVersionGeneral(FFstrbuf* exe, FFstrbuf* version)