diff --git a/cmd.go b/cmd.go index d152d52d..8711f3a5 100644 --- a/cmd.go +++ b/cmd.go @@ -521,7 +521,7 @@ func complete() error { return err } -// PassToPacman outsorces execution to pacman binary without modifications. +// passToPacman outsorces execution to pacman binary without modifications. func passToPacman(parser *arguments) error { var cmd *exec.Cmd args := make([]string, 0) @@ -541,3 +541,19 @@ func passToPacman(parser *arguments) error { err := cmd.Run() return err } + +// passToMakepkg outsorces execution to makepkg binary without modifications. +func passToMakepkg(dir string, args ...string) (err error) { + cmd := exec.Command(config.MakepkgBin, args...) + cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr + cmd.Dir = dir + err = cmd.Run() + if err == nil { + _ = saveVCSInfo() + if config.CleanAfter { + fmt.Println("\x1b[1;32m==> CleanAfter enabled. Deleting source folder.\x1b[0m") + os.RemoveAll(dir) + } + } + return +} \ No newline at end of file diff --git a/install.go b/install.go index d9ed502c..002f12f1 100644 --- a/install.go +++ b/install.go @@ -162,18 +162,7 @@ func PkgInstall(a *rpc.Pkg, flags []string) (finalmdeps []string, err error) { } } - args := []string{"-sri"} - args = append(args, flags...) - makepkgcmd := exec.Command(config.MakepkgBin, args...) - makepkgcmd.Stdin, makepkgcmd.Stdout, makepkgcmd.Stderr = os.Stdin, os.Stdout, os.Stderr - makepkgcmd.Dir = dir - err = makepkgcmd.Run() - if err == nil { - _ = saveVCSInfo() - if config.CleanAfter { - fmt.Println("\x1b[1;32m==> CleanAfter enabled. Deleting source folder.\x1b[0m") - os.RemoveAll(dir) - } - } + flags = append(flags, "-sri") + err = passToMakepkg(dir, flags...) return }