Skip to content

Commit

Permalink
TerminalShell: improve xonsh version detection
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed Jan 17, 2024
1 parent c749f21 commit 2808b1a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/detection/terminalshell/terminalshell.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
return getExeVersionRaw(exe, version);
if(strcasecmp(exeName, "ash") == 0)
return getShellVersionAsh(exe, version);
if(strcasecmp(exeName, "python") == 0 && getenv("XONSH_VERSION"))
if((strcasecmp(exeName, "xonsh") == 0 || strcasecmp(exeName, "python") == 0) && getenv("XONSH_VERSION"))
{
ffStrbufSetS(version, getenv("XONSH_VERSION"));
return true;
Expand Down
3 changes: 2 additions & 1 deletion src/detection/terminalshell/terminalshell_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ static pid_t getTerminalInfo(FFTerminalResult* result, pid_t pid)
ffStrEquals(name, "git-shell") ||
ffStrEquals(name, "elvish") ||
ffStrEquals(name, "oil.ovm") ||
(ffStrEquals(name, "python") && getenv("XONSH_VERSION"))
ffStrEquals(name, "xonsh") ||
ffStrEndsWith(name, ".sh")
)
{
pid = ppid;
Expand Down

0 comments on commit 2808b1a

Please sign in to comment.