Skip to content

Commit 55634df

Browse files
authored
Merge pull request kubernetes-sigs#7972 from Rohitrajak1807/private/Rohitrajak1807/bug-write-to-flag
🐛 bugfix write-to flag should only run filepath.Clean when the output file is not "" or -
2 parents aa511d8 + 0884032 commit 55634df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/clusterctl/cmd/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ func printYamlOutput(printer client.YamlPrinter, outputFile string) error {
3838
if err != nil {
3939
return err
4040
}
41-
outputFile = filepath.Clean(strings.TrimSpace(outputFile))
4241
yaml = append(yaml, '\n')
42+
outputFile = strings.TrimSpace(outputFile)
4343
if outputFile == "" || outputFile == "-" {
4444
if _, err := os.Stdout.Write(yaml); err != nil {
4545
return errors.Wrap(err, "failed to write yaml to Stdout")
4646
}
4747
return nil
4848
}
49-
49+
outputFile = filepath.Clean(outputFile)
5050
if err := os.WriteFile(outputFile, yaml, 0600); err != nil {
5151
return errors.Wrap(err, "failed to write to destination file")
5252
}

0 commit comments

Comments
 (0)