From fe3d7891e92444c38150d3321d6c7c2bac170a82 Mon Sep 17 00:00:00 2001 From: Martchus Date: Fri, 5 Apr 2024 17:58:14 +0200 Subject: [PATCH] Avoid unconditional use of `std::errc::stream_timeout` It looks like `libstdc++` and `libc++` only define this `enum class` member when the `ETIME` macro is defined. To prevent build errors when this macro is not defined it makes sense to check for this error only conditionally. --- syncthingconnector/syncthingprocess.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/syncthingconnector/syncthingprocess.cpp b/syncthingconnector/syncthingprocess.cpp index 24fcff9..857e65b 100644 --- a/syncthingconnector/syncthingprocess.cpp +++ b/syncthingconnector/syncthingprocess.cpp @@ -481,7 +481,12 @@ void SyncthingProcess::start(const QStringList &programs, const QStringList &arg if (started) { emit finished(0, QProcess::CrashExit); } - const auto error = ec == std::errc::timed_out || ec == std::errc::stream_timeout ? QProcess::Timedout : QProcess::Crashed; + const auto error = ec == std::errc::timed_out +#ifdef ETIME + || ec == std::errc::stream_timeout +#endif + ? QProcess::Timedout + : QProcess::Crashed; const auto msg = ec.message(); std::cerr << EscapeCodes::Phrases::Error << "Unable to launch process: " << msg << EscapeCodes::Phrases::End; QMetaObject::invokeMethod(