forked from qt-creator/qt-creator
Utils: Return Result from UnixDeviceFileAccess::runInShellSuccess
Change-Id: Id3fc04d08aa01f9c87831293cbd993cebd53d834 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -1067,12 +1067,15 @@ static Utils::unexpected<QString> make_unexpected_disconnected()
|
||||
|
||||
UnixDeviceFileAccess::~UnixDeviceFileAccess() = default;
|
||||
|
||||
bool UnixDeviceFileAccess::runInShellSuccess(const CommandLine &cmdLine,
|
||||
const QByteArray &stdInData) const
|
||||
Result UnixDeviceFileAccess::runInShellSuccess(const CommandLine &cmdLine,
|
||||
const QByteArray &stdInData) const
|
||||
{
|
||||
if (disconnected())
|
||||
return false;
|
||||
return runInShell(cmdLine, stdInData).exitCode == 0;
|
||||
return Result::Error("disconnected");
|
||||
const int retval = runInShell(cmdLine, stdInData).exitCode;
|
||||
if (retval != 0)
|
||||
return Result::Error(QString("return value %1").arg(retval));
|
||||
return Result::Ok;
|
||||
}
|
||||
|
||||
bool UnixDeviceFileAccess::isExecutableFile(const FilePath &filePath) const
|
||||
|
@@ -144,7 +144,7 @@ public:
|
||||
protected:
|
||||
virtual RunResult runInShell(const CommandLine &cmdLine,
|
||||
const QByteArray &inputData = {}) const = 0;
|
||||
bool runInShellSuccess(const CommandLine &cmdLine, const QByteArray &stdInData = {}) const;
|
||||
Result runInShellSuccess(const CommandLine &cmdLine, const QByteArray &stdInData = {}) const;
|
||||
|
||||
bool isExecutableFile(const FilePath &filePath) const override;
|
||||
bool isReadableFile(const FilePath &filePath) const override;
|
||||
|
Reference in New Issue
Block a user