Skip to content

Commit

Permalink
fix: file writer error
Browse files Browse the repository at this point in the history
  • Loading branch information
FMotalleb committed Jun 6, 2024
1 parent 8f3e24d commit 87ef610
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ dist/
# env files that usually contain secrets or local config
.env
.envrc
.log
12 changes: 0 additions & 12 deletions crontab-go.log

This file was deleted.

3 changes: 2 additions & 1 deletion logger/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ func (w *writer) Write(b []byte) (n int, e error) {

if w.file != nil {
wf, er := w.file.Write(b)
if wf != n {
if wf != n && n != 0 {
return n, fmt.Errorf("wrote two different amount of log into stdout(%d) and file(%d)", written, wf)
}
n = wf
if er != nil {
err = er
}
Expand Down

0 comments on commit 87ef610

Please sign in to comment.