From 79243fd46314b905e79f902dcfbe5553b39d9278 Mon Sep 17 00:00:00 2001 From: Evgenii Novozhilov Date: Tue, 17 Dec 2024 20:48:36 +0200 Subject: [PATCH] bugfix for v2024.12.03 release (#7183) * fixed bug where bazel runs with curses when using the old sync view (#7139) The old sync view does not use a pty based terminal and cannot handle bazel output correctly when it runs with curses. (cherry picked from commit 0fb3f8107480cd57b69f30dd357826eed02ca13b) * fixed bug where bazel automatically enables curses (#7143) Bazel is still run using a PtyCommandLine and seems to automatically enable curses when using the old sync view. (cherry picked from commit 2bea8d9d26786b7c8a459de5c25770c2dd0ca3b3) * Do not append `\n` for PROCESS since that output has all of the delimiters and can be chunked not per line. (#7146) (cherry picked from commit f5f8f24a8b84726b7b1606ba3d7b16b072da09a7) --- .../idea/blaze/base/buildview/BazelExecService.kt | 12 +++++++++--- .../idea/blaze/base/toolwindow/ConsoleView.java | 12 +++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/base/src/com/google/idea/blaze/base/buildview/BazelExecService.kt b/base/src/com/google/idea/blaze/base/buildview/BazelExecService.kt index 850f5be1bc4..6a4e0e4ad88 100644 --- a/base/src/com/google/idea/blaze/base/buildview/BazelExecService.kt +++ b/base/src/com/google/idea/blaze/base/buildview/BazelExecService.kt @@ -66,7 +66,14 @@ class BazelExecService(private val project: Project) : Disposable { } private suspend fun execute(ctx: BlazeContext, cmdBuilder: BlazeCommand.Builder): Int { - val cmd = cmdBuilder.apply { addBlazeFlags("--curses=yes") }.build() + // the old sync view does not use a PTY based terminal + if (BuildViewMigration.present(ctx)) { + cmdBuilder.addBlazeFlags("--curses=yes") + } else { + cmdBuilder.addBlazeFlags("--curses=no") + } + + val cmd = cmdBuilder.build() val root = cmd.effectiveWorkspaceRoot.orElseGet { WorkspaceRoot.fromProject(project).path() } val size = BuildViewScope.of(ctx)?.consoleSize ?: PtyConsoleView.DEFAULT_SIZE @@ -182,5 +189,4 @@ class BazelExecService(private val project: Project) : Disposable { } } } -} - +} \ No newline at end of file diff --git a/base/src/com/google/idea/blaze/base/toolwindow/ConsoleView.java b/base/src/com/google/idea/blaze/base/toolwindow/ConsoleView.java index aa2d4272281..d14a06e1c9a 100644 --- a/base/src/com/google/idea/blaze/base/toolwindow/ConsoleView.java +++ b/base/src/com/google/idea/blaze/base/toolwindow/ConsoleView.java @@ -241,11 +241,13 @@ private void println(String text, OutputType outputType) { text, outputType == OutputType.ERROR ? ProcessOutputTypes.STDERR : ProcessOutputTypes.STDOUT, (t, k) -> consoleView.print(t, ConsoleViewContentType.getConsoleViewType(k))); - consoleView.print( - "\n", - outputType == OutputType.ERROR - ? ConsoleViewContentType.ERROR_OUTPUT - : ConsoleViewContentType.NORMAL_OUTPUT); + if (outputType != OutputType.PROCESS) { + consoleView.print( + "\n", + outputType == OutputType.ERROR + ? ConsoleViewContentType.ERROR_OUTPUT + : ConsoleViewContentType.NORMAL_OUTPUT); + } } public void printHyperlink(String text, HyperlinkInfo hyperlinkInfo) {