Skip to content

Commit 09b2136

Browse files
committed
fix: ignore EINVAL when fsyncing /dev/stdout
Fixes: coder/coder#5532
1 parent 52d7dfa commit 09b2136

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cli/scaletest.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strconv"
1010
"strings"
1111
"sync"
12+
"syscall"
1213
"time"
1314

1415
"github.com/google/uuid"
@@ -185,7 +186,9 @@ func (o *scaleTestOutput) write(res harness.Results, stdout io.Writer) error {
185186
// Sync the file to disk if it's a file.
186187
if s, ok := w.(interface{ Sync() error }); ok {
187188
err := s.Sync()
188-
if err != nil {
189+
// On Linux, EINVAL is returned when calling fsync on /dev/stdout. We
190+
// can safely ignore this error.
191+
if err != nil && !xerrors.Is(err, syscall.EINVAL) {
189192
return xerrors.Errorf("flush output file: %w", err)
190193
}
191194
}

0 commit comments

Comments
 (0)