diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2022-05-06 02:16:54 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2022-05-09 07:42:02 +0000 |
commit | d8ee25ec3db039368ac0440af647fd7afd80079b (patch) | |
tree | de55d7076c9902cfb11fa0ba447a14667cf52223 /src/libs/ssh/sshremoteprocess.cpp | |
parent | 48d1bd0551243ed541068f0c52f72bac81041997 (diff) |
Move setupSshEnvironment() into SshConnectionParameters
As we are going to remove SshRemoteProcess.
Change-Id: I07cf246791f1adb6cfc454935d7e330c2f1d4dc7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/libs/ssh/sshremoteprocess.cpp')
-rw-r--r-- | src/libs/ssh/sshremoteprocess.cpp | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/libs/ssh/sshremoteprocess.cpp b/src/libs/ssh/sshremoteprocess.cpp index 7c4b089fd8..f0b52d5ff2 100644 --- a/src/libs/ssh/sshremoteprocess.cpp +++ b/src/libs/ssh/sshremoteprocess.cpp @@ -25,6 +25,7 @@ #include "sshremoteprocess.h" +#include "sshconnection.h" #include "sshlogging_p.h" #include "sshsettings.h" @@ -54,7 +55,7 @@ namespace QSsh { SshRemoteProcess::SshRemoteProcess(const QString &command, const QStringList &connectionArgs) : QtcProcess() { - setupSshEnvironment(this); + SshConnectionParameters::setupSshEnvironment(this); m_remoteCommand = command; m_connectionArgs = connectionArgs; } @@ -112,23 +113,4 @@ CommandLine SshRemoteProcess::fullLocalCommandLine(bool inTerminal) const return cmd; } -bool SshRemoteProcess::setupSshEnvironment(QtcProcess *process) -{ - Environment env = process->hasEnvironment() ? process->environment() - : Environment::systemEnvironment(); - const bool hasDisplay = env.hasKey("DISPLAY") && (env.value("DISPLAY") != QString(":0")); - if (SshSettings::askpassFilePath().exists()) { - env.set("SSH_ASKPASS", SshSettings::askpassFilePath().toUserOutput()); - - // OpenSSH only uses the askpass program if DISPLAY is set, regardless of the platform. - if (!env.hasKey("DISPLAY")) - env.set("DISPLAY", ":0"); - } - process->setEnvironment(env); - - // Otherwise, ssh will ignore SSH_ASKPASS and read from /dev/tty directly. - process->setDisableUnixTerminal(); - return hasDisplay; -} - } // namespace QSsh |