summaryrefslogtreecommitdiff
path: root/internal/sh
diff options
context:
space:
mode:
Diffstat (limited to 'internal/sh')
-rw-r--r--internal/sh/sh.go21
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
-}