github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/internal/robustio/robustio_darwin.go (about)

     1  // Copyright 2019 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package robustio
     6  
     7  import (
     8  	"errors"
     9  	"syscall"
    10  )
    11  
    12  const errFileNotFound = syscall.ENOENT
    13  
    14  // isEphemeralError returns true if err may be resolved by waiting.
    15  func isEphemeralError(err error) bool {
    16  	var errno syscall.Errno
    17  	if errors.As(err, &errno) {
    18  		return errno == errFileNotFound
    19  	}
    20  	return false
    21  }