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:
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
- Minor: Added context menu action to toggle visibility of offline tabs. (#5318)
|
- Minor: Added context menu action to toggle visibility of offline tabs. (#5318)
|
||||||
- Minor: Report sub duration for more multi-month gift cases. (#5319)
|
- 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 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 split tooltip getting stuck in some cases. (#5309)
|
||||||
- Bugfix: Fixed the version string not showing up as expected in Finder on macOS. (#5311)
|
- Bugfix: Fixed the version string not showing up as expected in Finder on macOS. (#5311)
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ const QStringList &broadcastingBinaries()
|
|||||||
bool isBroadcasterSoftwareActive()
|
bool isBroadcasterSoftwareActive()
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
|
||||||
|
static bool shouldShowTimeoutWarning = true;
|
||||||
|
static bool shouldShowWarning = true;
|
||||||
|
|
||||||
QProcess p;
|
QProcess p;
|
||||||
p.start("pgrep", {"-xi", broadcastingBinaries().join("|")},
|
p.start("pgrep", {"-xi", broadcastingBinaries().join("|")},
|
||||||
QIODevice::NotOpen);
|
QIODevice::NotOpen);
|
||||||
@@ -62,20 +65,46 @@ bool isBroadcasterSoftwareActive()
|
|||||||
|
|
||||||
// Fallback to false and showing a warning
|
// Fallback to false and showing a warning
|
||||||
|
|
||||||
static bool shouldShowWarning = true;
|
switch (p.error())
|
||||||
if (shouldShowWarning)
|
|
||||||
{
|
{
|
||||||
shouldShowWarning = false;
|
case QProcess::Timedout: {
|
||||||
|
qCWarning(chatterinoStreamerMode) << "pgrep execution timed out!";
|
||||||
|
if (shouldShowTimeoutWarning)
|
||||||
|
{
|
||||||
|
shouldShowTimeoutWarning = false;
|
||||||
|
|
||||||
postToThread([] {
|
postToThread([] {
|
||||||
getApp()->twitch->addGlobalSystemMessage(
|
getApp()->twitch->addGlobalSystemMessage(
|
||||||
"Streamer Mode is set to Automatic, but pgrep is missing. "
|
"Streamer Mode is set to Automatic, but pgrep timed "
|
||||||
"Install it to fix the issue or set Streamer Mode to "
|
"out. This can happen if your system lagged at the "
|
||||||
"Enabled or Disabled in the Settings.");
|
"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;
|
return false;
|
||||||
#elif defined(Q_OS_WIN)
|
#elif defined(Q_OS_WIN)
|
||||||
if (!IsWindowsVistaOrGreater())
|
if (!IsWindowsVistaOrGreater())
|
||||||
|
|||||||
Reference in New Issue
Block a user