Skip to content

Commit

Permalink
Inherit the entire login shell environment on macOS, not just PATH.
Browse files Browse the repository at this point in the history
  • Loading branch information
orbitalquark committed Sep 9, 2024
1 parent ad8f570 commit 32c1c80
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/textadept_qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 32c1c80

Please sign in to comment.