mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
fix: improve error messaging when pgrep fails streamer mode detection (#5321)
When launching pgrep times out, a timeout message is now posted instead of the default "pgrep is not installed" error.
This commit is contained in:
parent
f4e950ea0b
commit
bf8266e9b3
|
@ -4,6 +4,7 @@
|
|||
|
||||
- Minor: Added context menu action to toggle visibility of offline tabs. (#5318)
|
||||
- Minor: Report sub duration for more multi-month gift cases. (#5319)
|
||||
- Minor: Improved error reporting for the automatic streamer mode detection on Linux and macOS. (#5321)
|
||||
- Bugfix: Fixed a crash that could occur on Wayland when using the image uploader. (#5314)
|
||||
- Bugfix: Fixed split tooltip getting stuck in some cases. (#5309)
|
||||
- Bugfix: Fixed the version string not showing up as expected in Finder on macOS. (#5311)
|
||||
|
|
|
@ -51,6 +51,9 @@ const QStringList &broadcastingBinaries()
|
|||
bool isBroadcasterSoftwareActive()
|
||||
{
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
|
||||
static bool shouldShowTimeoutWarning = true;
|
||||
static bool shouldShowWarning = true;
|
||||
|
||||
QProcess p;
|
||||
p.start("pgrep", {"-xi", broadcastingBinaries().join("|")},
|
||||
QIODevice::NotOpen);
|
||||
|
@ -62,20 +65,46 @@ bool isBroadcasterSoftwareActive()
|
|||
|
||||
// Fallback to false and showing a warning
|
||||
|
||||
static bool shouldShowWarning = true;
|
||||
if (shouldShowWarning)
|
||||
switch (p.error())
|
||||
{
|
||||
shouldShowWarning = false;
|
||||
case QProcess::Timedout: {
|
||||
qCWarning(chatterinoStreamerMode) << "pgrep execution timed out!";
|
||||
if (shouldShowTimeoutWarning)
|
||||
{
|
||||
shouldShowTimeoutWarning = false;
|
||||
|
||||
postToThread([] {
|
||||
getApp()->twitch->addGlobalSystemMessage(
|
||||
"Streamer Mode is set to Automatic, but pgrep is missing. "
|
||||
"Install it to fix the issue or set Streamer Mode to "
|
||||
"Enabled or Disabled in the Settings.");
|
||||
});
|
||||
postToThread([] {
|
||||
getApp()->twitch->addGlobalSystemMessage(
|
||||
"Streamer Mode is set to Automatic, but pgrep timed "
|
||||
"out. This can happen if your system lagged at the "
|
||||
"wrong moment. If Streamer Mode continues to not work, "
|
||||
"you can manually set it to Enabled or Disabled in the "
|
||||
"Settings.");
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default: {
|
||||
qCWarning(chatterinoStreamerMode)
|
||||
<< "pgrep execution failed:" << p.error();
|
||||
|
||||
if (shouldShowWarning)
|
||||
{
|
||||
shouldShowWarning = false;
|
||||
|
||||
postToThread([] {
|
||||
getApp()->twitch->addGlobalSystemMessage(
|
||||
"Streamer Mode is set to Automatic, but pgrep is "
|
||||
"missing. "
|
||||
"Install it to fix the issue or set Streamer Mode to "
|
||||
"Enabled or Disabled in the Settings.");
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
qCWarning(chatterinoStreamerMode) << "pgrep execution timed out!";
|
||||
return false;
|
||||
#elif defined(Q_OS_WIN)
|
||||
if (!IsWindowsVistaOrGreater())
|
||||
|
|
Loading…
Reference in a new issue