diff --git a/cmd/subber/subber.go b/cmd/subber/subber.go index 6b0fc51..023ac7f 100644 --- a/cmd/subber/subber.go +++ b/cmd/subber/subber.go @@ -155,7 +155,22 @@ func writeText(outFileName string, skipBackups bool, text string) error { return err } } - return os.WriteFile(outFileName, []byte(text), 0644) + + f, err := os.Create(outFileName) + if err != nil { + return err + } + defer f.Close() + + _, err = f.WriteString(text) + if err != nil { + return err + } + err = f.Sync() + if err != nil { + return err + } + return f.Close() } func fileExists(name string) bool {