mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
Move passToPackman from config.go to cmd.go
This commit is contained in:
parent
df27396fa0
commit
68a9771327
2 changed files with 21 additions and 20 deletions
20
cmd.go
20
cmd.go
|
@ -6,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -488,3 +489,22 @@ func complete() error {
|
||||||
_, err = io.Copy(os.Stdout, in)
|
_, err = io.Copy(os.Stdout, in)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PassToPacman outsorces execution to pacman binary without modifications.
|
||||||
|
func passToPacman(parser *argParser) error {
|
||||||
|
var cmd *exec.Cmd
|
||||||
|
args := make([]string, 0)
|
||||||
|
|
||||||
|
if parser.needRoot() {
|
||||||
|
args = append(args, "sudo")
|
||||||
|
}
|
||||||
|
|
||||||
|
args = append(args, "pacman")
|
||||||
|
args = append(args, parser.formatArgs()...)
|
||||||
|
|
||||||
|
cmd = exec.Command(args[0], args[1:]...)
|
||||||
|
|
||||||
|
cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr
|
||||||
|
err := cmd.Run()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
21
config.go
21
config.go
|
@ -194,23 +194,4 @@ func continueTask(s string, def string) (cont bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// PassToPacman outsorces execution to pacman binary without modifications.
|
|
||||||
func passToPacman(parser *argParser) error {
|
|
||||||
var cmd *exec.Cmd
|
|
||||||
args := make([]string, 0)
|
|
||||||
|
|
||||||
if parser.needRoot() {
|
|
||||||
args = append(args, "sudo")
|
|
||||||
}
|
|
||||||
|
|
||||||
args = append(args, "pacman")
|
|
||||||
args = append(args, parser.formatArgs()...)
|
|
||||||
|
|
||||||
cmd = exec.Command(args[0], args[1:]...)
|
|
||||||
|
|
||||||
cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr
|
|
||||||
err := cmd.Run()
|
|
||||||
return err
|
|
||||||
}
|
|
Loading…
Reference in a new issue