mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 10:52:08 +02:00
WMI: add timeout to prevent CI from hanging
Hard coded 5 seconds
This commit is contained in:
@@ -111,9 +111,7 @@ FFWmiQuery::FFWmiQuery(const wchar_t* queryStr, FFstrbuf* error, FFWmiNamespace
|
||||
}
|
||||
|
||||
// Use the IWbemServices pointer to make requests of WMI
|
||||
HRESULT hres;
|
||||
|
||||
hres = ((IWbemServices*)context)->ExecQuery(
|
||||
HRESULT hres = ((IWbemServices*)context)->ExecQuery(
|
||||
bstr_t(L"WQL"),
|
||||
bstr_t(queryStr),
|
||||
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
|
||||
|
||||
@@ -18,6 +18,10 @@ enum class FFWmiNamespace {
|
||||
LAST,
|
||||
};
|
||||
|
||||
enum {
|
||||
FF_WMI_QUERY_TIMEOUT = 5000
|
||||
};
|
||||
|
||||
struct FFWmiRecord
|
||||
{
|
||||
IWbemClassObject* obj;
|
||||
@@ -26,7 +30,7 @@ struct FFWmiRecord
|
||||
if(!pEnumerator) return;
|
||||
|
||||
ULONG ret;
|
||||
bool ok = SUCCEEDED(pEnumerator->Next((LONG)WBEM_INFINITE, 1, &obj, &ret)) && ret;
|
||||
bool ok = SUCCEEDED(pEnumerator->Next(FF_WMI_QUERY_TIMEOUT, 1, &obj, &ret)) && ret;
|
||||
if(!ok) obj = nullptr;
|
||||
}
|
||||
FFWmiRecord(const FFWmiRecord&) = delete;
|
||||
|
||||
Reference in New Issue
Block a user