mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
fix(cli): scaletest: ignore errors syncing output (#13076)
This commit is contained in:
@ -14,7 +14,6 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
@ -245,14 +244,8 @@ func (o *scaleTestOutput) write(res harness.Results, stdout io.Writer) error {
|
|||||||
|
|
||||||
// Sync the file to disk if it's a file.
|
// Sync the file to disk if it's a file.
|
||||||
if s, ok := w.(interface{ Sync() error }); ok {
|
if s, ok := w.(interface{ Sync() error }); ok {
|
||||||
err := s.Sync()
|
// Best effort. If we get an error from syncing, just ignore it.
|
||||||
// On Linux, EINVAL is returned when calling fsync on /dev/stdout. We
|
_ = s.Sync()
|
||||||
// can safely ignore this error.
|
|
||||||
// On macOS, ENOTTY is returned when calling sync on /dev/stdout. We
|
|
||||||
// can safely ignore this error.
|
|
||||||
if err != nil && !xerrors.Is(err, syscall.EINVAL) && !xerrors.Is(err, syscall.ENOTTY) {
|
|
||||||
return xerrors.Errorf("flush output file: %w", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if c != nil {
|
if c != nil {
|
||||||
|
Reference in New Issue
Block a user