Use QtcProcess for ssh key gen

Change-Id: I5a1ddf7f6773467c57571fe385fc1969e347c582
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2021-11-02 10:54:49 +01:00
parent a50c5db110
commit 9e8b838080

View File

@@ -30,10 +30,10 @@
#include <utils/fileutils.h>
#include <utils/pathchooser.h>
#include <utils/qtcprocess.h>
#include <QApplication>
#include <QMessageBox>
#include <QProcess>
#include <QStandardPaths>
using namespace Utils;
@@ -90,12 +90,12 @@ void SshKeyCreationDialog::generateKeys()
}
const QString keyTypeString = QLatin1String(m_ui->rsa->isChecked() ? "rsa": "ecdsa");
QApplication::setOverrideCursor(Qt::BusyCursor);
QProcess keygen;
QtcProcess keygen;
const QStringList args{"-t", keyTypeString, "-b", m_ui->comboBox->currentText(),
"-N", QString(), "-f", privateKeyFilePath().path()};
QString errorMsg;
keygen.start(SshSettings::keygenFilePath().toString(), args);
keygen.closeWriteChannel();
keygen.setCommand({SshSettings::keygenFilePath(), args});
keygen.start();
if (!keygen.waitForStarted() || !keygen.waitForFinished())
errorMsg = keygen.errorString();
else if (keygen.exitCode() != 0)