forked from qt-creator/qt-creator
Utils: Use QtcProcess in FilePath::fileContents
Change-Id: Ia7236632c6d9b887d054a3254762b7e3592e73e1 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -960,14 +960,20 @@ expected_str<QByteArray> UnixDeviceFileAccess::fileContents(const FilePath &file
|
||||
args += QString("count=%1").arg(limit / gcd);
|
||||
args += QString("seek=%1").arg(offset / gcd);
|
||||
}
|
||||
#ifndef UTILS_STATIC_LIBRARY
|
||||
const FilePath dd = filePath.withNewPath("dd");
|
||||
|
||||
const RunResult r = runInShell({"dd", args, OsType::OsTypeLinux});
|
||||
|
||||
if (r.exitCode != 0)
|
||||
QtcProcess p;
|
||||
p.setCommand({dd, args, OsType::OsTypeLinux});
|
||||
p.runBlocking();
|
||||
if (p.exitCode() != 0) {
|
||||
return make_unexpected(Tr::tr("Failed reading file \"%1\": %2")
|
||||
.arg(filePath.toUserOutput(), QString::fromUtf8(r.stdErr)));
|
||||
|
||||
return r.stdOut;
|
||||
.arg(filePath.toUserOutput(), p.readAllStandardError()));
|
||||
}
|
||||
return p.readAllRawStandardOutput();
|
||||
#else
|
||||
return make_unexpected(QString("Not implemented"));
|
||||
#endif
|
||||
}
|
||||
|
||||
expected_str<qint64> UnixDeviceFileAccess::writeFileContents(const FilePath &filePath,
|
||||
|
Reference in New Issue
Block a user