github.com/verrazzano/verrazzano@v1.7.1/pkg/os/shell.go (about) 1 // Copyright (c) 2021, 2023, Oracle and/or its affiliates. 2 // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. 3 4 package os 5 6 import ( 7 osexec "os/exec" 8 ) 9 10 // bashRunner needed for unit tests 11 var bashRunner CmdRunner = DefaultRunner{} 12 13 // RunBash runs a bash script 14 func RunBash(inArgs ...string) (string, string, error) { 15 args := []string{} 16 args = append(args, inArgs...) 17 18 cmd := osexec.Command("bash", args...) 19 stdout, stderr, err := bashRunner.Run(cmd) 20 if err != nil { 21 return string(stdout), string(stderr), err 22 } 23 return string(stdout), "", err 24 }