Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2022-11-07 14:53:40 +0300
committerHannah von Reth <vonreth@kde.org>2022-11-08 16:45:53 +0300
commit02274cd5241f3f401397511ded63d227d157a15c (patch)
treeb9f9a109b2a37b95a22a26221bfd010f621ff7ab /src
parent5648f3932af3882acfc495d7a3216bd1b609a676 (diff)
Fix unit test
Diffstat (limited to 'src')
-rw-r--r--src/common/utility.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/common/utility.cpp b/src/common/utility.cpp
index 6f8f44ae8..d705dc537 100644
--- a/src/common/utility.cpp
+++ b/src/common/utility.cpp
@@ -366,24 +366,22 @@ void Utility::crash()
// restarting from the installer.
QByteArray Utility::versionOfInstalledBinary(const QString &command)
{
- QByteArray re;
- if (isLinux()) {
- QString binary(command);
- if (binary.isEmpty()) {
- binary = qApp->arguments()[0];
- }
- QStringList params;
- params << QStringLiteral("--version");
- QProcess process;
- process.start(binary, params);
- process.waitForFinished(); // sets current thread to sleep and waits for pingProcess end
- re = process.readAllStandardOutput();
- int newline = re.indexOf('\n');
- if (newline > 0) {
- re.truncate(newline);
- }
+ QString binary(command);
+ if (binary.isEmpty()) {
+ binary = qApp->arguments()[0];
}
- return re;
+ QStringList params;
+ params << QStringLiteral("--version");
+ QProcess process;
+ process.start(binary, params);
+ process.waitForFinished(); // sets current thread to sleep and waits for pingProcess end
+ QByteArray re = process.readAllStandardOutput();
+ qCDebug(lcUtility) << Q_FUNC_INFO << re;
+ int newline = re.indexOf('\n');
+ if (newline > 0) {
+ re.truncate(newline);
+ }
+ return re.trimmed();
}
QString Utility::timeAgoInWords(const QDateTime &dt, const QDateTime &from)
@@ -645,4 +643,4 @@ QDebug &operator<<(QDebug &debug, nanoseconds in)
<< min.count() << "min, "
<< s.count() << "s, "
<< ms.count() << "ms)";
-} \ No newline at end of file
+}