mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[terminal] IJPL-249991 Fix Port Forwarding widget absence on Windows client
The problem was in the incorrect socket symlink format we receive from the Linux host on Windows. The roots go deep into details how Unix paths are represented on Windows via EEL API: IJPL-213371. Fix it by mapping the incorrect file path back to the Linux representation. (cherry picked from commit 7411b02732b0aec6d6a5890ebb7e307024ec24a9) IJ-CR-213436 GitOrigin-RevId: a762373d03c956ef970de00af406f4df6ebacb20
This commit is contained in:
committed by
intellij-monorepo-bot
parent
01ea68512e
commit
54e60147df
+10
-1
@@ -8,11 +8,13 @@ import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.diagnostic.trace
|
||||
import com.intellij.platform.eel.EelApi
|
||||
import com.intellij.platform.eel.EelDescriptor
|
||||
import com.intellij.platform.eel.channels.EelDelicateApi
|
||||
import com.intellij.platform.eel.fs.readFile
|
||||
import com.intellij.platform.eel.getOrThrow
|
||||
import com.intellij.platform.eel.isLinux
|
||||
import com.intellij.platform.eel.path.EelPath
|
||||
import com.intellij.platform.eel.provider.asNioPath
|
||||
import com.intellij.platform.eel.provider.utils.impl.localToIjent
|
||||
import com.intellij.util.io.toByteArray
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import java.nio.file.Files
|
||||
@@ -115,7 +117,14 @@ private fun readLinuxSocketInodesForPid(eelDescriptor: EelDescriptor, pid: Long)
|
||||
catch (_: NoSuchFileException) {
|
||||
continue // Process can be already terminated
|
||||
}
|
||||
val match = socketInodeRegex.matchEntire(target) ?: continue
|
||||
// The Linux kernel renders required symlink targets as "socket:[<inode>]".
|
||||
// On a Windows host, however, the WSL 9P layer and IntelliJ's EEL nio provider transliterate ':'
|
||||
// — illegal in Windows paths — to the private-use char U+F03A (see IJPL-213371),
|
||||
// so the target arrives as "socket[<inode>]".
|
||||
// Use the `localToIjent` utility to get the correct socket representation (with ':').
|
||||
@OptIn(EelDelicateApi::class)
|
||||
val translatedTarget = localToIjent(target)
|
||||
val match = socketInodeRegex.matchEntire(translatedTarget) ?: continue
|
||||
val inode = match.groupValues[1].toLongOrNull() ?: continue
|
||||
result.add(inode)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user