From a14df4590103abe3ad6e577c46ca6cc8bba252e6 Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Thu, 21 Apr 2022 11:34:25 -0700 Subject: [PATCH] add /usr/local/bin to PATH env to help find drivers --- gui/window.cpp | 15 +++++++++++++++ gui/window.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/gui/window.cpp b/gui/window.cpp index 5ca295c2a6..6fc3b82906 100644 --- a/gui/window.cpp +++ b/gui/window.cpp @@ -82,6 +82,7 @@ #include #include #include +#include #ifndef QT_NO_TERMWIDGET #include @@ -116,6 +117,14 @@ Window::Window() setWindowIcon(*trayIconIcon); } +QProcessEnvironment Window::setMacEnv() +{ + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + QString path = env.value("PATH"); + env.insert("PATH", path + ":/usr/local/bin"); + return env; +} + void Window::createBasicView() { basicStartButton = new QPushButton(tr("Start")); @@ -523,6 +532,12 @@ bool Window::sendMinikubeCommand(QStringList cmds, QString &text) arguments << cmds; QProcess *process = new QProcess(this); +#if __APPLE__ + if (env.isEmpty()) { + env = setMacEnv(); + } + process->setProcessEnvironment(env); +#endif process->start(program, arguments); this->setCursor(Qt::WaitCursor); bool timedOut = process->waitForFinished(300 * 1000); diff --git a/gui/window.h b/gui/window.h index 95fc57b80f..f4ea230644 100644 --- a/gui/window.h +++ b/gui/window.h @@ -57,6 +57,7 @@ #include #include #include +#include #ifndef QT_NO_SYSTEMTRAYICON @@ -166,12 +167,14 @@ private: void dashboardBrowser(); Cluster createClusterObject(QJsonObject obj); QProcess *dashboardProcess; + QProcessEnvironment env; // Error messaging void outputFailedStart(QString text); QLabel *createLabel(QString title, QString text, QFormLayout *form, bool isLink); void checkForMinikube(); + QProcessEnvironment setMacEnv(); QStackedWidget *stackedWidget; bool isBasicView; };