From 4fecc76083bebc31e0bfa47e7313f98c617ebd3d Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Tue, 15 Jun 2021 09:51:55 +0200 Subject: [PATCH] specific fish version code --- src/common/detectTerminalShell.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/common/detectTerminalShell.c b/src/common/detectTerminalShell.c index 5507fc39f..b019ddc01 100644 --- a/src/common/detectTerminalShell.c +++ b/src/common/detectTerminalShell.c @@ -166,6 +166,18 @@ static void getShellVersionZsh(FFstrbuf* exe, FFstrbuf* version) }); } +static void getShellVersionFish(FFstrbuf* exe, FFstrbuf* version) +{ + ffProcessAppendStdOut(version, (char* const[]) { + "env", + "-i", + exe->chars, + "-c", + "printf \"%s\" \"$FISH_VERSION\"", + NULL + }); +} + static void getShellVersionGeneric(FFstrbuf* exe, const char* exeName, FFstrbuf* version) { FFstrbuf command; @@ -194,6 +206,8 @@ static void getShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* versio getShellVersionBash(exe, version); else if(strcasecmp(exeName, "zsh") == 0) getShellVersionZsh(exe, version); + else if(strcasecmp(exeName, "fish") == 0) + getShellVersionFish(exe, version); else getShellVersionGeneric(exe, exeName, version); }