From 040bf31b56542488238a85f758c3c0e0c7b2e9e5 Mon Sep 17 00:00:00 2001 From: Micheal Wilkinson Date: Thu, 19 Mar 2026 14:29:52 +0000 Subject: [PATCH] fix(core): route status and diff output through app writers --- internal/homesick/core/core.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/homesick/core/core.go b/internal/homesick/core/core.go index ab1d99f..d2d7f23 100644 --- a/internal/homesick/core/core.go +++ b/internal/homesick/core/core.go @@ -126,11 +126,11 @@ func (a *App) List() error { } func (a *App) Status(castle string) error { - return runGit(filepath.Join(a.ReposDir, castle), "status") + return runGitWithIO(filepath.Join(a.ReposDir, castle), a.Stdout, a.Stderr, "status") } func (a *App) Diff(castle string) error { - return runGit(filepath.Join(a.ReposDir, castle), "diff") + return runGitWithIO(filepath.Join(a.ReposDir, castle), a.Stdout, a.Stderr, "diff") } func (a *App) Link(castle string) error { @@ -511,10 +511,14 @@ func matchesIgnoredDir(castleHome string, candidate string, subdirs []string) (b } func runGit(dir string, args ...string) error { + return runGitWithIO(dir, os.Stdout, os.Stderr, args...) +} + +func runGitWithIO(dir string, stdout io.Writer, stderr io.Writer, args ...string) error { cmd := exec.Command("git", args...) cmd.Dir = dir - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr + cmd.Stdout = stdout + cmd.Stderr = stderr if err := cmd.Run(); err != nil { return fmt.Errorf("git %s failed: %w", strings.Join(args, " "), err) }