mirror of
https://github.com/Jguer/yay.git
synced 2024-11-06 09:07:21 +01:00
Move makepkg handling to its own function
This commit is contained in:
parent
96f499ff44
commit
44f83e03ea
18
cmd.go
18
cmd.go
@ -521,7 +521,7 @@ func complete() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// PassToPacman outsorces execution to pacman binary without modifications.
|
// passToPacman outsorces execution to pacman binary without modifications.
|
||||||
func passToPacman(parser *arguments) error {
|
func passToPacman(parser *arguments) error {
|
||||||
var cmd *exec.Cmd
|
var cmd *exec.Cmd
|
||||||
args := make([]string, 0)
|
args := make([]string, 0)
|
||||||
@ -541,3 +541,19 @@ func passToPacman(parser *arguments) error {
|
|||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
return err
|
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
|
||||||
|
}
|
15
install.go
15
install.go
@ -162,18 +162,7 @@ func PkgInstall(a *rpc.Pkg, flags []string) (finalmdeps []string, err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []string{"-sri"}
|
flags = append(flags, "-sri")
|
||||||
args = append(args, flags...)
|
err = passToMakepkg(dir, 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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user