Skip to content

Commit ec4c23d

Browse files
authored
fix(internal/libarian/java): switching to command.Run for execute format (#4193)
Switch to use `command.Run` helper instead of `exec.CommandContext`.
1 parent 8a35c66 commit ec4c23d

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

internal/librarian/java/generate.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"path/filepath"
2424
"strings"
2525

26+
"github.com/googleapis/librarian/internal/command"
2627
"github.com/googleapis/librarian/internal/config"
2728
)
2829

@@ -60,9 +61,7 @@ func Format(ctx context.Context, library *config.Library) error {
6061
}
6162

6263
args := append([]string{"--replace"}, files...)
63-
cmd := exec.CommandContext(ctx, "google-java-format", args...)
64-
cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr
65-
if err := cmd.Run(); err != nil {
64+
if err := command.Run(ctx, "google-java-format", args...); err != nil {
6665
return fmt.Errorf("formatting failed: %w", err)
6766
}
6867
return nil

0 commit comments

Comments
 (0)