forked from qt-creator/qt-creator
FilePath: Return optional bytearray from device hooks
For differentiating between "error" and "empty file". Change-Id: I1806bb7386f5e7db28489f9f7e685648bfc20110 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -958,7 +958,9 @@ void DockerDevice::iterateDirectory(const FilePath &filePath,
|
||||
FileUtils::iterateLsOutput(filePath, entries, filter, callBack);
|
||||
}
|
||||
|
||||
QByteArray DockerDevice::fileContents(const FilePath &filePath, qint64 limit, qint64 offset) const
|
||||
std::optional<QByteArray> DockerDevice::fileContents(const FilePath &filePath,
|
||||
qint64 limit,
|
||||
qint64 offset) const
|
||||
{
|
||||
QTC_ASSERT(handlesFile(filePath), return {});
|
||||
updateContainerAccess();
|
||||
@@ -976,6 +978,8 @@ QByteArray DockerDevice::fileContents(const FilePath &filePath, qint64 limit, qi
|
||||
proc.start();
|
||||
proc.waitForFinished();
|
||||
|
||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
||||
return {};
|
||||
QByteArray output = proc.readAllStandardOutput();
|
||||
return output;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user