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;
|
UnixDeviceFileAccess::~UnixDeviceFileAccess() = default;
|
||||||
|
|
||||||
bool UnixDeviceFileAccess::runInShellSuccess(const CommandLine &cmdLine,
|
Result UnixDeviceFileAccess::runInShellSuccess(const CommandLine &cmdLine,
|
||||||
const QByteArray &stdInData) const
|
const QByteArray &stdInData) const
|
||||||
{
|
{
|
||||||
if (disconnected())
|
if (disconnected())
|
||||||
return false;
|
return Result::Error("disconnected");
|
||||||
return runInShell(cmdLine, stdInData).exitCode == 0;
|
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
|
bool UnixDeviceFileAccess::isExecutableFile(const FilePath &filePath) const
|
||||||
|
@@ -144,7 +144,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual RunResult runInShell(const CommandLine &cmdLine,
|
virtual RunResult runInShell(const CommandLine &cmdLine,
|
||||||
const QByteArray &inputData = {}) const = 0;
|
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 isExecutableFile(const FilePath &filePath) const override;
|
||||||
bool isReadableFile(const FilePath &filePath) const override;
|
bool isReadableFile(const FilePath &filePath) const override;
|
||||||
|
Reference in New Issue
Block a user