Cleanup open pipes if logging binary fails to start
Signed-off-by: Akshat Kumar <kshtku@amazon.com>
This commit is contained in:
@@ -18,6 +18,7 @@ package runtime
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
@@ -42,3 +43,11 @@ func NewBinaryCmd(binaryURI *url.URL, id, ns string) *exec.Cmd {
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
// CloseFiles closes any files passed in.
|
||||
// It it used for cleanup in the event of unexpected errors.
|
||||
func CloseFiles(files ...*os.File) {
|
||||
for _, file := range files {
|
||||
file.Close()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user