Skip to content

Commit 2385209

Browse files
committed
Refine logging in writeFiles function to ensure correct handling of single and multiple newline characters
1 parent 46be841 commit 2385209

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/utils_fs.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ func writeFiles(paths []string, contents []string, logger *logger.Logger) error
129129
logger.UpdateLastSecondaryPrefix("setup")
130130

131131
if strings.HasSuffix(content, "\n") {
132-
if strings.Count(content, "\n") > 1 {
133-
logger.Infof("echo -e %q > %q", content, paths[i])
134-
} else {
132+
if strings.Count(content, "\n") == 1 {
135133
logger.Infof("echo %q > %q", content[:len(content)-1], paths[i])
134+
} else {
135+
logger.Infof("echo -e %q > %q", content[:len(content)-1], paths[i])
136136
}
137137
} else {
138138
logger.Infof("echo -n %q > %q", content, paths[i])

0 commit comments

Comments
 (0)