forked from qt-creator/qt-creator
Docker/Linux: Fix outputForRunInShell
... in case there is embedded NUL in the output. Change-Id: Ic899bcf8d01cceed4ea6e16d4991fb80b7ac70ca Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -738,6 +738,8 @@ MimeType Utils::mimeTypeForFile(const QFileInfo &fileInfo, MimeMatchMode mode)
|
|||||||
MimeType Utils::mimeTypeForFile(const FilePath &filePath, MimeMatchMode mode)
|
MimeType Utils::mimeTypeForFile(const FilePath &filePath, MimeMatchMode mode)
|
||||||
{
|
{
|
||||||
MimeDatabase mdb;
|
MimeDatabase mdb;
|
||||||
|
if (filePath.needsDevice())
|
||||||
|
return mdb.mimeTypeForUrl(filePath.toUrl());
|
||||||
return mdb.mimeTypeForFile(filePath.toString(), MimeDatabase::MatchMode(mode));
|
return mdb.mimeTypeForFile(filePath.toString(), MimeDatabase::MatchMode(mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1733,7 +1733,7 @@ QString DockerDevicePrivate::outputForRunInShell(const CommandLine &cmd) const
|
|||||||
LOG("Run command in shell:" << cmd.toUserOutput() << "output size:" << output.size());
|
LOG("Run command in shell:" << cmd.toUserOutput() << "output size:" << output.size());
|
||||||
if (QTC_GUARD(output.endsWith(markerWithNewLine)))
|
if (QTC_GUARD(output.endsWith(markerWithNewLine)))
|
||||||
output.chop(markerWithNewLine.size());
|
output.chop(markerWithNewLine.size());
|
||||||
return QString::fromUtf8(output);
|
return QString::fromUtf8(output, output.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Factory
|
// Factory
|
||||||
|
@@ -270,7 +270,7 @@ public:
|
|||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
output = output.left(pos);
|
output = output.left(pos);
|
||||||
DEBUG("CHOPPED2 " << output);
|
DEBUG("CHOPPED2 " << output);
|
||||||
return QString::fromUtf8(output);
|
return QString::fromUtf8(output, output.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isRunning() const { return m_shell; }
|
bool isRunning() const { return m_shell; }
|
||||||
|
Reference in New Issue
Block a user