},
infoCommand{
label: "Disk Space",
- cmd: []string{"df", "-m", "/"},
+ cmd: []string{"df", "-m", "/", os.TempDir()},
},
infoCommand{
- label: "Disk Space",
- cmd: []string{"df", "-m", os.TempDir()},
+ label: "Disk INodes",
+ cmd: []string{"df", "-i", "/", os.TempDir()},
},
}
// Run commands with informational output to be logged.
var out []byte
for _, command := range commands {
- out, err = exec.Command(command.cmd[0], command.cmd[1:]...).Output()
+ out, err = exec.Command(command.cmd[0], command.cmd[1:]...).CombinedOutput()
if err != nil {
- return fmt.Errorf("While running command '%s': %v",
- command.cmd[0], err)
+ return fmt.Errorf("While running command %q: %v",
+ command.cmd, err)
}
logger.Println(command.label)
for _, line := range strings.Split(string(out), "\n") {
if err != nil {
return fmt.Errorf("While retrieving container record from the API server: %v", err)
}
+ defer reader.Close()
// Read the API server response as []byte
json_bytes, err := ioutil.ReadAll(reader)
if err != nil {