diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp index 12ab39a8c74..f31053ca8c4 100644 --- a/src/plugins/projectexplorer/runcontrol.cpp +++ b/src/plugins/projectexplorer/runcontrol.cpp @@ -50,6 +50,8 @@ #include #include +#include + #include #include #include @@ -1067,6 +1069,15 @@ bool RunControl::showPromptToStopDialog(const QString &title, return close; } +void RunControl::provideAskPassEntry(Environment &env) +{ + if (env.value("SUDO_ASKPASS").isEmpty()) { + const FilePath askpass = QSsh::SshSettings::askpassFilePath(); + if (askpass.exists()) + env.set("SUDO_ASKPASS", askpass.toUserOutput()); + } +} + bool RunControlPrivate::isAllowedTransition(RunControlState from, RunControlState to) { switch (from) { diff --git a/src/plugins/projectexplorer/runcontrol.h b/src/plugins/projectexplorer/runcontrol.h index 0dfd35edf8c..03b8041246b 100644 --- a/src/plugins/projectexplorer/runcontrol.h +++ b/src/plugins/projectexplorer/runcontrol.h @@ -250,6 +250,8 @@ public: const QString &cancelButtonText = QString(), bool *prompt = nullptr); + static void provideAskPassEntry(Utils::Environment &env); + RunWorker *createWorker(Utils::Id workerId); bool createMainWorker();