forked from qt-creator/qt-creator
RemoteLinux: Use Process's output decoding
in the GenericDirectUploadStep ("Upload files via SFTP") Change-Id: I2165460a3af3496279c967c7180c5d8d0b96504b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QTextCodec>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Tasking;
|
using namespace Tasking;
|
||||||
@@ -110,14 +111,14 @@ QDateTime GenericDirectUploadStep::timestampFromStat(const DeployableFile &file,
|
|||||||
.arg(file.remoteFilePath(), error));
|
.arg(file.remoteFilePath(), error));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const QByteArray output = statProc->readAllRawStandardOutput().trimmed();
|
const QString output = statProc->readAllStandardOutput().trimmed();
|
||||||
const QString warningString(Tr::tr("Unexpected stat output for remote file \"%1\": %2")
|
const QString warningString(Tr::tr("Unexpected stat output for remote file \"%1\": %2")
|
||||||
.arg(file.remoteFilePath()).arg(QString::fromUtf8(output)));
|
.arg(file.remoteFilePath()).arg(output));
|
||||||
if (!output.startsWith(file.remoteFilePath().toUtf8())) {
|
if (!output.startsWith(file.remoteFilePath())) {
|
||||||
addWarningMessage(warningString);
|
addWarningMessage(warningString);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const QByteArrayList columns = output.mid(file.remoteFilePath().toUtf8().size() + 1).split(' ');
|
const QStringList columns = output.mid(file.remoteFilePath().size() + 1).split(' ');
|
||||||
if (columns.size() < 14) { // Normal Linux stat: 16 columns in total, busybox stat: 15 columns
|
if (columns.size() < 14) { // Normal Linux stat: 16 columns in total, busybox stat: 15 columns
|
||||||
addWarningMessage(warningString);
|
addWarningMessage(warningString);
|
||||||
return {};
|
return {};
|
||||||
@@ -136,6 +137,7 @@ GroupItem GenericDirectUploadStep::statTask(UploadStorage *storage,
|
|||||||
StatEndHandler statEndHandler)
|
StatEndHandler statEndHandler)
|
||||||
{
|
{
|
||||||
const auto onSetup = [this, file](Process &process) {
|
const auto onSetup = [this, file](Process &process) {
|
||||||
|
process.setCodec(QTextCodec::codecForName("UTF-8"));
|
||||||
// We'd like to use --format=%Y, but it's not supported by busybox.
|
// We'd like to use --format=%Y, but it's not supported by busybox.
|
||||||
process.setCommand({deviceConfiguration()->filePath("stat"),
|
process.setCommand({deviceConfiguration()->filePath("stat"),
|
||||||
{"-t", Utils::ProcessArgs::quoteArgUnix(file.remoteFilePath())}});
|
{"-t", Utils::ProcessArgs::quoteArgUnix(file.remoteFilePath())}});
|
||||||
|
Reference in New Issue
Block a user