Test report and trees stdout write failures (closes #30)
check / check (push) Successful in 1m34s
check / check (push) Successful in 1m34s
report and trees already checked every stdout write and the final flush. run now takes the stdout it hands to them, so tests pass a closed file or a failing writer instead of swapping os.Stdout: a closed stdout exits 1 with a one-line diagnostic, and the writer's error reaches the caller. README "Error handling" now states the two cases that never reach sfdupes as a failed write: a pipe reader that exits early ends the process with SIGPIPE, as with cat; and stdout closed with >&- is replaced by /dev/null by the Go runtime before main runs, so the run succeeds. Model: opus-5-5
This commit was merged in pull request #74.
This commit is contained in:
+2
-1
@@ -7,6 +7,7 @@ import (
|
||||
"database/sql"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@@ -1548,7 +1549,7 @@ func TestScanHashWriteFailureUnwindsPool(t *testing.T) {
|
||||
|
||||
code := run([]string{
|
||||
cmdScan, "--workers", strconv.Itoa(hashLeakWorkers), dir,
|
||||
}, &stderr)
|
||||
}, io.Discard, &stderr)
|
||||
if code != exitFatal {
|
||||
t.Fatalf("run(scan) = %d, want %d; stderr: %s",
|
||||
code, exitFatal, stderr.String())
|
||||
|
||||
Reference in New Issue
Block a user