Shell (macOS): better xonsh detection

Fix #977
This commit is contained in:
李通洲
2024-05-30 09:27:35 +08:00
parent 1863bde916
commit d7e9094297
2 changed files with 13 additions and 0 deletions
+1
View File
@@ -15,6 +15,7 @@ Features:
* See `fastfetch -h format` for detail
* Add option `--color-separator` to set the color of key-value separators
* Support Guix package manager count (#792, Packages, Linux)
* Improve python based shell detection (#977, Shell, macOS)
Bugfixes:
* Don't detect `.conf` files in `--list-config-paths`
+12
View File
@@ -165,6 +165,18 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons
do arg0++; while (*arg0 == '\0');
assert(arg0 < procArgs2 + len);
{
// #977
char* p = (char*) strrchr(arg0, '/');
if (p)
{
p++;
if (ffStrStartsWithIgnCase(p, "python")) // /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/Resources/Python.app/Contents/MacOS/Python /Users/carter/.local/bin/xonsh
arg0 = p + strlen(p) + 1;
}
}
if (*arg0 == '-') arg0++; // Login shells
ffStrbufSetS(exe, arg0);