From d43ed33661f8c3b97be7bdcace8536c59ad94292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 9 Jan 2026 16:08:54 +0800 Subject: [PATCH] Shell (macOS): fixes `exePath` not reports absolute paths --- src/common/impl/processing_linux.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/common/impl/processing_linux.c b/src/common/impl/processing_linux.c index ad76c6c00..3ec67e97d 100644 --- a/src/common/impl/processing_linux.c +++ b/src/common/impl/processing_linux.c @@ -320,16 +320,21 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons ffStrbufSetS(exe, arg0); } } - else + + if (exePath || exe->length == 0) { char buf[PROC_PIDPATHINFO_MAXSIZE]; int length = proc_pidpath(pid, buf, ARRAY_SIZE(buf)); if (length > 0) { - ffStrbufEnsureFixedLengthFree(exe, (uint32_t) length); - ffStrbufAppendNS(exe, (uint32_t) length, buf); + if (exe->length == 0) + ffStrbufSetNS(exe, (uint32_t) length, buf); if (exePath) - ffStrbufSet(exePath, exe); + { + // We don't use exec_path above as exePath because it's a relative path and can be different + // from the actual executable being run (for example, when the original file is moved) + ffStrbufSetNS(exePath, (uint32_t) length, buf); + } } }