mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[eel, terminal] IJPL-224593 do not set TERM environment variable on Windows
`TERM` is specific to Unix-like systems (https://www.gnu.org/software/gettext/manual/html_node/The-TERM-variable.html). `TERM` is not used on Windows; instead, Windows apps use Windows APIs to detect console capabilities. Therefore, Windows Terminal and Command Prompt do not set it, as expected. Setting `TERM` on Windows can make some cross-platform tools wrongly assume specific console capabilities and start emitting ANSI escape sequences. Although modern Windows consoles handle these sequences correctly, this leads to behavioral differences compared to Windows Terminal (see IJPL-224593). To align with native Windows Terminal behavior, let's avoid setting `TERM` on Windows. Space-RevId: d1162b704d433e29c59783c8f6c994715727d2da GitOrigin-RevId: a01f4bd8b6f9a2e364a60ef8b553fd4baf3cc07d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
60f70b4286
commit
1d8ec5e529
@@ -295,10 +295,11 @@ private fun executeImpl(builder: EelExecApi.ExecuteProcessOptions): Process {
|
||||
// Inherit env vars because lack of `PATH` might break things
|
||||
val environment = System.getenv().toMutableMap()
|
||||
environment.putAll(builder.env)
|
||||
val escapedCommandLine = CommandLineUtil.toCommandLine(builder.exe, builder.args, Platform.current())
|
||||
val platform = Platform.current()
|
||||
val escapedCommandLine = CommandLineUtil.toCommandLine(builder.exe, builder.args, platform)
|
||||
return when (val p = pty) {
|
||||
is EelExecApi.Pty -> {
|
||||
if ("TERM" !in environment) {
|
||||
if (platform == Platform.UNIX && "TERM" !in environment) {
|
||||
environment.getOrPut("TERM") { "xterm" }
|
||||
}
|
||||
LocalProcessService.getInstance().startPtyProcess(
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.intellij.openapi.util.SystemInfoRt
|
||||
import com.intellij.platform.eel.*
|
||||
import com.intellij.platform.eel.EelExecApi.Pty
|
||||
import com.intellij.platform.eel.impl.local.getShellFromPasswdRecords
|
||||
import com.intellij.platform.eel.provider.LocalEelDescriptor
|
||||
import com.intellij.platform.eel.provider.localEel
|
||||
import com.intellij.platform.eel.provider.utils.sendWholeText
|
||||
import com.intellij.platform.tests.eelHelpers.EelHelper
|
||||
@@ -179,8 +180,10 @@ class EelLocalExecApiTest {
|
||||
PTY_SIZE_FROM_START, PTY_RESIZE_LATER -> {
|
||||
Assertions.assertNotNull(ttyState.size)
|
||||
Assertions.assertEquals(Size(PTY_COLS, PTY_ROWS), ttyState.size, "size must be set for tty")
|
||||
val expectedTerm = System.getenv("TERM") ?: "xterm"
|
||||
Assertions.assertEquals(expectedTerm, ttyState.termName, "Wrong term type")
|
||||
if (LocalEelDescriptor.osFamily.isPosix) {
|
||||
val expectedTerm = System.getenv("TERM") ?: "xterm"
|
||||
Assertions.assertEquals(expectedTerm, ttyState.termName, "Wrong term type")
|
||||
}
|
||||
}
|
||||
NO_PTY -> {
|
||||
Assertions.assertNull(ttyState.size, "size must not be set if no tty")
|
||||
|
||||
Reference in New Issue
Block a user