← back to Cli Printing Press
fix(cli): propagate ReadDir error in explicitOutput collision guard
0d4e711c1a624b8ae78f4e61fa8a1f93040345df · 2026-03-27 19:54:53 -0700 · Trevin Chow
Previously os.ReadDir error was silently discarded, causing a
permission-denied directory to appear empty and bypass the collision
check.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Files touched
Diff
commit 0d4e711c1a624b8ae78f4e61fa8a1f93040345df
Author: Trevin Chow <trevin@trevinchow.com>
Date: Fri Mar 27 19:54:53 2026 -0700
fix(cli): propagate ReadDir error in explicitOutput collision guard
Previously os.ReadDir error was silently discarded, causing a
permission-denied directory to appear empty and bypass the collision
check.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---
internal/cli/root.go | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/internal/cli/root.go b/internal/cli/root.go
index c40a9d19..8d643c05 100644
--- a/internal/cli/root.go
+++ b/internal/cli/root.go
@@ -350,7 +350,10 @@ func claimOrForce(absOut string, force bool, explicitOutput bool) (string, error
if explicitOutput {
if info, err := os.Stat(absOut); err == nil && info.IsDir() {
- entries, _ := os.ReadDir(absOut)
+ entries, readErr := os.ReadDir(absOut)
+ if readErr != nil {
+ return "", fmt.Errorf("reading output directory: %w", readErr)
+ }
if len(entries) > 0 {
return "", fmt.Errorf("output directory %s already exists (use --force to overwrite)", absOut)
}
← e2e68fb9 docs: mark implementation plan as completed
·
back to Cli Printing Press
·
refactor(pipeline): use stable-numbered PlanPath instead of 630cd0b5 →