Skip to content

Commit

Permalink
bugfix for v2024.12.03 release (#7183)
Browse files Browse the repository at this point in the history
* 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 0fb3f81)

* 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 2bea8d9)

* 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 f5f8f24)
  • Loading branch information
ujohnny authored Dec 17, 2024
1 parent 0129a1f commit 79243fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -182,5 +189,4 @@ class BazelExecService(private val project: Project) : Disposable {
}
}
}
}

}
12 changes: 7 additions & 5 deletions base/src/com/google/idea/blaze/base/toolwindow/ConsoleView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 79243fd

Please sign in to comment.