From 6d49a9416e048f05027fd4a494cc2a38f6077d98 Mon Sep 17 00:00:00 2001 From: cd-amn Date: Tue, 2 Jun 2026 16:59:53 +0400 Subject: [PATCH] fix: propagate tun2socks FailedToStart in XrayProtocol --- client/core/protocols/xrayProtocol.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/client/core/protocols/xrayProtocol.cpp b/client/core/protocols/xrayProtocol.cpp index 35c4beb52..10ea4d747 100644 --- a/client/core/protocols/xrayProtocol.cpp +++ b/client/core/protocols/xrayProtocol.cpp @@ -183,7 +183,20 @@ ErrorCode XrayProtocol::startTun2Socks() m_tun2socksProcess->setArguments({ "-device", QString("tun://%1").arg(m_tunName), "-proxy", proxyUrl }); connect( - m_tun2socksProcess.data(), &IpcProcessInterfaceReplica::readyReadStandardError, this, + m_tun2socksProcess.data(), &IpcProcessInterfaceReplica::errorOccurred, this, + [this](QProcess::ProcessError error) { + if (error != QProcess::FailedToStart) { + // Other errors are reported via the finished signal or are transient. + return; + } + qCritical() << "Tun2socks failed to start"; + stop(); + setLastError(ErrorCode::Tun2SockExecutableMissing); + }, + Qt::QueuedConnection); + + connect( + m_tun2socksProcess.data(), &IpcProcessInterfaceReplica::readyReadStandardError, this, [this]() { auto readAllStandardError = m_tun2socksProcess->readAllStandardError(); if (!readAllStandardError.waitForFinished()) {