refactor: seperate files, function and structs into seperate packages
This commit is contained in:
parent
7f951585c8
commit
5b7775f33e
37 changed files with 547 additions and 677 deletions
23
internal/shell/shell.go
Normal file
23
internal/shell/shell.go
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package shell
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
var (
|
||||
ExecCommand = exec.Command
|
||||
ExecLookPath = exec.LookPath
|
||||
)
|
||||
|
||||
func ExecuteShellCommand(command string, env string) error {
|
||||
cmd := ExecCommand("bash", "-c", command)
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Env = append(cmd.Env, env)
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("befehl fehlgeschlagen: %v\nAusgabe: %s", err, output)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue