[wsl] PY-84375: Do not catch CE, deprecate outdated class.

`WSLProxy` is poorly written (trust me, I am the author) and completely redundant with Eel/Ijent approach.

Do not use it, use Eel API.

Moreover, it caught CE effectively breaking the contract. It should catch `IOException` only.


(cherry picked from commit 8db94aaa0777944fd806692746ed23cb18935121)

IJ-CR-182156

GitOrigin-RevId: a0bc168659e154be42dc6ed519846a2b63cf8497
This commit is contained in:
Ilya.Kazakevich
2025-11-11 04:53:29 +01:00
committed by intellij-monorepo-bot
parent eb6d9dd416
commit bdbff02dd8

View File

@@ -20,6 +20,9 @@ import java.nio.ByteOrder
import kotlin.coroutines.coroutineContext
/**
* *Warning*: This class is *deprecated*. Use Eel API.
*
*
* The problem is covered here: PY-50689.
*
* Intellij debuggers opens port and waits debugee to connect to it.
@@ -34,6 +37,7 @@ import kotlin.coroutines.coroutineContext
*
*/
@ApiStatus.Internal
@Deprecated("Please use Eel API instead")
class WslProxy(distro: AbstractWslDistribution, private val applicationAddress: InetSocketAddress) : Disposable {
@Deprecated("Use the construction with the application address." +
" This constructor can lead to sporadic 'connection refused' errors in case of IPv4/IPv6 confusion.")
@@ -80,19 +84,21 @@ class WslProxy(distro: AbstractWslDistribution, private val applicationAddress:
try {
outputStream.close() // Closing stream should stop process
}
catch (e: Exception) {
catch (e: IOException) {
Logger.getInstance(WslProxy::class.java).warn(e)
}
GlobalScope.launch(Dispatchers.IO) {
// Wait for process to die. If not -- kill it
delay(1000)
if (isAlive) {
Logger.getInstance(WslProxy::class.java).warn("Process still alive, destroying")
destroy()
}
val exitCode = exitValue()
if (exitCode != 0) {
Logger.getInstance(WslProxy::class.java).warn("Exit code was $exitCode")
finally {
GlobalScope.launch(Dispatchers.IO) {
// Wait for process to die. If not -- kill it
delay(1000)
if (isAlive) {
Logger.getInstance(WslProxy::class.java).warn("Process still alive, destroying")
destroy()
}
val exitCode = exitValue()
if (exitCode != 0) {
Logger.getInstance(WslProxy::class.java).warn("Exit code was $exitCode")
}
}
}
}