Skip to content

Commit

Permalink
fix: do not patch output buffer for build-language command
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitriy Poluyanov committed Dec 14, 2021
1 parent 21c84d7 commit 26f4138
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package main

import (
bep "bazel-wsl/bep"
"bazel-wsl/bep"
"bazel-wsl/utils"
"bufio"
"bytes"
Expand Down Expand Up @@ -55,6 +55,7 @@ func main() {

var bepIDEAOutputPath = ""
var bepOutputPath = ""
var patchOutputBuffer = true
for _, arg := range os.Args[1:] {
// https://github.com/bazelbuild/intellij/pull/2976/files
fo.WriteString(arg + "\n")
Expand All @@ -81,6 +82,9 @@ func main() {
wslPath := utils.WinToWSLPath(fileName)

bazelArgs = append(bazelArgs, "--override_repository=intellij_aspect="+wslPath)
} else if strings.HasPrefix(arg, "build-language") {
patchOutputBuffer = false
bazelArgs = append(bazelArgs, arg)
} else {
bazelArgs = append(bazelArgs, arg)
}
Expand All @@ -104,8 +108,12 @@ func main() {

cmdErr := cmd.Run()

var patchedBuffer = PatchBuffer(&outBuffer)
os.Stdout.Write(patchedBuffer.Bytes())
if patchOutputBuffer {
var patchedBuffer = PatchBuffer(&outBuffer)
os.Stdout.Write(patchedBuffer.Bytes())
} else {
os.Stdout.Write(outBuffer.Bytes())
}

if bepOutputPath != "" && bepIDEAOutputPath != "" {
bepFrom, err1 := os.OpenFile(bepOutputPath, os.O_RDONLY, 0600)
Expand Down

0 comments on commit 26f4138

Please sign in to comment.