Skip to content

Commit e046787

Browse files
committed
Terminal: better tmux version detection
1 parent 743eeba commit e046787

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/detection/terminalshell/terminalshell.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,20 @@ static bool getTerminalVersionScreen(FFstrbuf* exe, FFstrbuf* version)
423423
return version->length > 0;
424424
}
425425

426+
static bool getTerminalVersionTmux(FFstrbuf* exe, FFstrbuf* version)
427+
{
428+
if (ffProcessAppendStdOut(version, (char* const[]) {
429+
exe->chars,
430+
"-V",
431+
NULL
432+
}) != NULL)
433+
return false;
434+
435+
// tmux 3.4
436+
ffStrbufSubstrAfterFirstC(version, ' ');
437+
return version->length > 0;
438+
}
439+
426440
#ifdef _WIN32
427441

428442
static bool getTerminalVersionWindowsTerminal(FFstrbuf* exe, FFstrbuf* version)
@@ -572,6 +586,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
572586
}
573587
}
574588

589+
if(ffStrbufStartsWithIgnCaseS(processName, "tmux"))
590+
return getTerminalVersionTmux(exe, version);
591+
575592
#ifdef _WIN32
576593

577594
return getFileVersion(exe->chars, version);

0 commit comments

Comments
 (0)