Skip to content

Commit

Permalink
Add newlines to port-forward error output
Browse files Browse the repository at this point in the history
Some of the port-forward errors print to stderr without a newline. This
can cause callers to inadvertently concatenate their own outputs to the
lower-level error message.

Add a `\n` to port-forward error outputs.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
  • Loading branch information
siggy committed Dec 24, 2024
1 parent c463750 commit 95cb104
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli/cmd/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func getContainerCertificate(k8sAPI *k8s.KubernetesAPI, pod corev1.Pod, containe

defer portForward.Stop()
if err = portForward.Init(); err != nil {
fmt.Fprintf(os.Stderr, "Error running port-forward: %s", err)
fmt.Fprintf(os.Stderr, "Error running port-forward: %s\n", err)
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/k8s/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func GetContainerMetrics(

defer portForward.Stop()
if err = portForward.Init(); err != nil {
fmt.Fprintf(os.Stderr, "Error running port-forward: %s", err)
fmt.Fprintf(os.Stderr, "Error running port-forward: %s\n", err)
return nil, err
}

Expand Down

0 comments on commit 95cb104

Please sign in to comment.