mirror of
https://codeberg.org/scip/io-exporter.git
synced 2025-12-16 20:11:00 +01:00
fix #5: nobody understands context deadline exceeded, use timeout
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
Version = `v0.0.6`
|
||||
Version = `v0.0.7`
|
||||
SLEEP = 5
|
||||
Usage = `io-exporter [options] <file>
|
||||
Options:
|
||||
|
||||
10
cmd/root.go
10
cmd/root.go
@@ -54,11 +54,17 @@ func Run() {
|
||||
}
|
||||
|
||||
func report(err error, fd *os.File) bool {
|
||||
slog.Debug("failed to check io", "error", err)
|
||||
failure := err.Error()
|
||||
if err.Error() == "context deadline exceeded" {
|
||||
failure = "operation timed out"
|
||||
}
|
||||
|
||||
slog.Debug("failed to check io", "error", failure)
|
||||
|
||||
if fd != nil {
|
||||
if err := fd.Close(); err != nil {
|
||||
slog.Debug("failed to close filehandle", "error", err)
|
||||
|
||||
slog.Debug("failed to close filehandle", "error", failure)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user