refactor: implement mocking functions and tests
This commit is contained in:
parent
339dba4e13
commit
f8ef2ef2d5
21 changed files with 398 additions and 90 deletions
|
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
|
@ -13,7 +12,7 @@ type Packages struct {
|
|||
|
||||
func installPackage(cmd, pkg, sudoPassword string) error {
|
||||
fullCmd := fmt.Sprintf("%s %s", cmd, pkg)
|
||||
command := exec.Command("sudo", "-S", "sh", "-c", fullCmd)
|
||||
command := execCommand("sudo", "-S", "sh", "-c", fullCmd)
|
||||
command.Stdin = strings.NewReader(sudoPassword + "\n")
|
||||
output, err := command.CombinedOutput()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue