diff options
| author | Claude <noreply@anthropic.com> | 2026-08-05 23:22:25 -0500 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-08-05 23:22:25 -0500 |
| commit | fc0c6951d7ac36dd8f30ace929991197dc99ae54 (patch) | |
| tree | 46fa11cc103ebe7805bf42bc3e4bb105e6b49721 /internal/sh | |
| parent | 9f7c9f2f31acd7bc544dd988af1c8c2fe63ec504 (diff) | |
Simplify: centralize paths in layout, dedup zfs snapshot refs, remove dead code
- Add layout.Config methods (ReleasesDir, PostReceiveHookPath, RCScriptPath,
RCConfPath) so main.go and jailmgr no longer hand-build paths that layout
already owns.
- Extract zfsutil.snapRef to replace three inline dataset@tag Sprintfs.
- Remove seven unused exported functions (zfsutil.Exists, jailmgr.Stop,
sh.RunWithStdinFile, and four dead layout.Config path methods) and their
now-unused imports.
Diffstat (limited to 'internal/sh')
| -rw-r--r-- | internal/sh/sh.go | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/internal/sh/sh.go b/internal/sh/sh.go index b5f6f49..6e12886 100644 --- a/internal/sh/sh.go +++ b/internal/sh/sh.go @@ -6,7 +6,6 @@ import ( "context" "fmt" "io" - "os" "os/exec" ) @@ -43,23 +42,3 @@ func CombinedOutput(ctx context.Context, dir string, name string, args ...string b, err := cmd.CombinedOutput() return string(b), err } - -// RunWithStdinFile runs a command with stdinPath fed to its stdin, e.g. -// piping a migration file into `sqlite3 db`. -func RunWithStdinFile(ctx context.Context, out io.Writer, dir, stdinPath, name string, args ...string) error { - f, err := os.Open(stdinPath) - if err != nil { - return fmt.Errorf("open %s: %w", stdinPath, err) - } - defer f.Close() - - cmd := exec.CommandContext(ctx, name, args...) - cmd.Dir = dir - cmd.Stdin = f - cmd.Stdout = out - cmd.Stderr = out - if err := cmd.Run(); err != nil { - return fmt.Errorf("%s %v < %s: %w", name, args, stdinPath, err) - } - return nil -} |
