Details
-
Task
-
Resolution: Fixed
-
P2: Important
-
None
-
None
-
-
025dea411 (master), feeca315e (16.0)
Description
Don't rely on QtcProcess::errorString() when choosing possible code paths, as this is just a human readable string. Please see how QIODevice::errorString() is implemented.
Example misuse:
void RsyncDeployService::createRemoteDirectories() { ... connect(m_mkdir.get(), &QtcProcess::done, this, [this] { QString userError; const QString error = m_mkdir->errorString(); if (!error.isEmpty()) ^^^ userError = error; if (m_mkdir->exitCode() != 0) userError = QString::fromUtf8(m_mkdir->readAllStandardError()); if (!userError.isEmpty()) { emit errorMessage(tr("Failed to create remote directories: %1").arg(userError)); setFinished(); return; } deployFiles(); }); ... }
Client code should first check if QtcProcess::error() != QProcessError::UnknownError.
Currently it's being worked around inside QtcProcessPrivate::handleDone() - see HACK comment.
Attachments
For Gerrit Dashboard: QTCREATORBUG-27363 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
617331,6 | PE: Replace QString with Utils::Result | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
617519,5 | SshKeyCreationDialog: Don't rely on QtcProcess::errorString() | 16.0 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |