From 8513e042b0033599146546bd3a2ad903c67c9ff5 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Thu, 16 Mar 2017 11:01:19 -0300 Subject: [PATCH] 10218: Split multi-line command output so that each line is written to the logs independently. --- services/crunch-run/crunchrun.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/crunch-run/crunchrun.go b/services/crunch-run/crunchrun.go index 88c93e56c6..f71ec4d46d 100644 --- a/services/crunch-run/crunchrun.go +++ b/services/crunch-run/crunchrun.go @@ -533,6 +533,7 @@ func (runner *ContainerRunner) LogNodeInfo() (err error) { newInfoCommand("Disk Space", "df -m"), } + // Run commands with informational output to be logged. var out []byte for _, command := range commands { out, err = exec.Command(command.command, command.args...).Output() @@ -540,7 +541,10 @@ func (runner *ContainerRunner) LogNodeInfo() (err error) { return fmt.Errorf("While running command '%s': %v", command.command, err) } - logger.Printf("%s:\n%s\n", command.label, out) + logger.Println(command.label) + for _, line := range strings.Split(string(out), "\n") { + logger.Println(" ", line) + } } err = w.Close() -- 2.30.2