IJPL-157074 Add the run.processes.using.pty.helper.on.mac.intel key

This way we can easily disable this hack if something goes wrong.
Do note that while we can disable this flag, it naturally won't
revert the pty4j version to the pre-hack state, so it's not a 100%
replacement for reverting all the commits that introduced
this hack to begin with.

GitOrigin-RevId: c6b0308cf031ecde71702f8eaf1d7512e22db0f9
This commit is contained in:
Sergei Tachenov
2024-07-23 17:51:23 +03:00
committed by intellij-monorepo-bot
parent 1750db957d
commit c9f1e32bbe
2 changed files with 5 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import com.intellij.openapi.application.PathManager
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.openapi.util.SystemInfo
import com.intellij.openapi.util.registry.Registry
import com.intellij.util.ReflectionUtil
import com.pty4j.PtyProcess
import com.pty4j.PtyProcessBuilder
@@ -42,7 +43,7 @@ class ProcessServiceImpl(private val coroutineScope: CoroutineScope) : ProcessSe
.setRedirectErrorStream(redirectErrorStream)
.setWindowsAnsiColorEnabled(windowsAnsiColorEnabled)
.setUnixOpenTtyToPreserveOutputAfterTermination(unixOpenTtyToPreserveOutputAfterTermination)
.setSpawnProcessUsingJdkOnMacIntel(true)
.setSpawnProcessUsingJdkOnMacIntel(Registry.`is`("run.processes.using.pty.helper.on.mac.intel", true))
val process = builder.start()
if (process is UnixPtyProcess && Platform.isMac() && Platform.isIntel()) {
coroutineScope.launch(Dispatchers.IO + CoroutineName("Reaper for $process")) {

View File

@@ -1323,6 +1323,9 @@ run.processes.with.pty.description=Allocate pseudo-terminal for running and debu
to check if they can operate in an interactive mode.\n\
Note that not all IDEs check this option and support PTY at all. Currently this option is used in CLion and PyCharm.
run.processes.using.pty.helper.on.mac.intel=true
run.processes.using.pty.helper.on.mac.intel.description=Use pty4j-unix-spawn-helper to work around the fork()/exec() crashes on macOS Sonoma + Intel x86_64
terminal.use.conpty.on.windows=true
terminal.use.conpty.on.windows.description=Use ConPTY API to run processes with PTY on Windows