mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-13 23:25:27 +08:00
#5603 Ignore exceptions in getOSInformation()
This commit is contained in:
committed by
Andrew Nelless
parent
088ac82e18
commit
02d75cd370
@@ -114,15 +114,18 @@ QString getOSInformation()
|
||||
QString result;
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
QStringList arguments;
|
||||
arguments.append("/etc/os-release");
|
||||
CommandProcess cp("/bin/cat", arguments);
|
||||
QString output = cp.run();
|
||||
result = "Linux";
|
||||
try {
|
||||
QStringList arguments;
|
||||
arguments.append("/etc/os-release");
|
||||
CommandProcess cp("/bin/cat", arguments);
|
||||
QString output = cp.run();
|
||||
|
||||
QRegExp resultRegex(".*PRETTY_NAME=\"([^\"]+)\".*");
|
||||
if (resultRegex.exactMatch(output)) {
|
||||
QString OSInfo = resultRegex.cap(1);
|
||||
result = OSInfo;
|
||||
QRegExp resultRegex(".*PRETTY_NAME=\"([^\"]+)\".*");
|
||||
if (resultRegex.exactMatch(output)) {
|
||||
result = resultRegex.cap(1);
|
||||
}
|
||||
} catch (...) {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user