Skip to content

Commit b76050d

Browse files
committed
add f.Sync to try and address #9
1 parent 1002041 commit b76050d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*.exe
2+
.vscode/
23
vendor/
3-
example/
4+
examples/
45
foo.go
56
foo_test.go

pkg/hostsapi/hostsapi.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ func (h *HostsAPI) Write() error {
182182
defer f.Close()
183183

184184
f.Write(outbuf.Bytes())
185+
err = f.Sync()
186+
if err != nil {
187+
return err
188+
}
185189

186190
return nil
187191
}

0 commit comments

Comments
 (0)