diff --git a/src/plugins/projectexplorer/devicesupport/sshparameters.cpp b/src/plugins/projectexplorer/devicesupport/sshparameters.cpp index 8ae238deba5..224a4c6595d 100644 --- a/src/plugins/projectexplorer/devicesupport/sshparameters.cpp +++ b/src/plugins/projectexplorer/devicesupport/sshparameters.cpp @@ -64,24 +64,21 @@ QStringList SshParameters::connectionOptions(const FilePath &binary) const "-o", "Port=" + QString::number(port())}; if (!userName().isEmpty()) - args.append({"-o", "User=" + userName()}); + args << "-o" << "User=" + userName(); - const bool keyOnly = authenticationType == - SshParameters::AuthenticationTypeSpecificKey; - if (keyOnly) { - args << "-o" << "IdentitiesOnly=yes"; - args << "-i" << privateKeyFile.path(); - } - if (keyOnly || SshSettings::askpassFilePath().isEmpty()) - args << "-o" << "BatchMode=yes"; + const bool keyOnly = authenticationType == SshParameters::AuthenticationTypeSpecificKey; + if (keyOnly) + args << "-o" << "IdentitiesOnly=yes" << "-i" << privateKeyFile.path(); - bool useTimeout = timeout != 0; - if (useTimeout && HostOsInfo::isWindowsHost() - && binary.toString().toLower().contains("/system32/")) { - useTimeout = false; - } + const QString batchModeEnabled = (keyOnly || SshSettings::askpassFilePath().isEmpty()) + ? QLatin1String("yes") : QLatin1String("no"); + args << "-o" << "BatchMode=" + batchModeEnabled; + + const bool isWindows = HostOsInfo::isWindowsHost() + && binary.toString().toLower().contains("/system32/"); + const bool useTimeout = (timeout != 0) && !isWindows; if (useTimeout) - args << "-o" << ("ConnectTimeout=" + QString::number(timeout)); + args << "-o" << "ConnectTimeout=" + QString::number(timeout); return args; } diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index b2982feb109..d90d01e3ab8 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -1609,8 +1609,8 @@ private: + ProcessArgs::quoteArgUnix(file.m_target.path()).toLocal8Bit() + '\n'); } m_batchFile->close(); - process().setStandardInputFile(m_batchFile->fileName()); - process().setCommand(CommandLine(sftpBinary, fullConnectionOptions() << host())); + process().setCommand(CommandLine(sftpBinary, fullConnectionOptions() + << "-b" << m_batchFile->fileName() << host())); process().start(); }