Skip to content

Commit a3d111a

Browse files
committed
fix: add os.O_SYNC flag to prevent empty revision.json on ungraceful shutdown
1 parent 0357803 commit a3d111a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/cmd/rev/rev.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func trySaveRevision(ctx context.Context, endpoints []string, outputFile string,
189189
}
190190

191191
tmpPath := fmt.Sprintf("%s.tmp", outputFile)
192-
file, err := os.OpenFile(tmpPath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
192+
file, err := os.OpenFile(tmpPath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC|os.O_SYNC, 0644)
193193
if err != nil {
194194
klog.Errorf("error opening file: %v", err)
195195
return

0 commit comments

Comments
 (0)