From 32c1c80678d7c97589e7913aed05f63aef95b3f8 Mon Sep 17 00:00:00 2001 From: orbitalquark <70453897+orbitalquark@users.noreply.github.com> Date: Mon, 9 Sep 2024 18:02:55 -0400 Subject: [PATCH] Inherit the entire login shell environment on macOS, not just PATH. --- src/textadept_qt.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/textadept_qt.cpp b/src/textadept_qt.cpp index f16db817..da7ee9ef 100644 --- a/src/textadept_qt.cpp +++ b/src/textadept_qt.cpp @@ -733,8 +733,9 @@ class Application : public SingleApplication { // Read $PATH from shell since macOS GUI apps run in a limited environment. QProcess p; p.startCommand(qgetenv("SHELL") + " -l -c env"), p.waitForFinished(); - QRegularExpression re{"^PATH=(.+)$", QRegularExpression::MultilineOption}; - if (auto m = re.match(p.readAll()); m.hasMatch()) qputenv("PATH", m.captured(1).toLocal8Bit()); + QRegularExpression re{"^([^=]+)=(.+)$", QRegularExpression::MultilineOption}; + for (const auto &match : re.globalMatch(p.readAll())) + qputenv(match.captured(1).toLocal8Bit(), match.captured(2).toLocal8Bit()); #endif connect(this, &SingleApplication::receivedMessage, this, [](quint32, QByteArray message) { ta->window()->activateWindow();