mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Shell (Linux): remove version detection for unknown shells
It's a dangerous operation. Should fix #1144
This commit is contained in:
@@ -200,28 +200,6 @@ static bool getShellVersionWinPowerShell(FFstrbuf* exe, FFstrbuf* version)
|
||||
NULL
|
||||
}) == NULL;
|
||||
}
|
||||
#else
|
||||
static bool getShellVersionGeneric(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY command = ffStrbufCreate();
|
||||
ffStrbufAppendS(&command, "printf \"%s\" \"$");
|
||||
ffStrbufAppendTransformS(&command, exeName, toupper);
|
||||
ffStrbufAppendS(&command, "_VERSION\"");
|
||||
|
||||
if (ffProcessAppendStdOut(version, (char* const[]) {
|
||||
"env",
|
||||
"-i",
|
||||
exe->chars,
|
||||
"-c",
|
||||
command.chars,
|
||||
NULL
|
||||
}) != NULL)
|
||||
return false;
|
||||
|
||||
ffStrbufSubstrBeforeFirstC(version, '(');
|
||||
ffStrbufRemoveStrings(version, 2, (const char*[]) { "-release", "release" });
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
|
||||
@@ -261,9 +239,9 @@ bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
|
||||
return getShellVersionWinPowerShell(exe, version);
|
||||
|
||||
return getFileVersion(exe->chars, version);
|
||||
#else
|
||||
return getShellVersionGeneric(exe, exeName, version);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
FF_MAYBE_UNUSED static bool getTerminalVersionTermux(FFstrbuf* version)
|
||||
|
||||
Reference in New Issue
Block a user