Skip to content

Commit 624e205

Browse files
committed
Adding split chars for windows vs linux
1 parent 978af3b commit 624e205

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

inspector/docker_stats.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,15 @@ type DockerStats struct {
3232
// Parse : run custom parsing on output of the command
3333
func (i *DockerStats) Parse(output string) {
3434
var values []DockerStatsMetrics
35+
var splitChars string
36+
details := (*i.Driver).GetDetails()
37+
if details.IsWindows {
38+
splitChars = "\r\n"
39+
} else {
40+
splitChars = "\n"
41+
}
3542
log.Debug("Parsing ouput string in DockerStats inspector")
36-
lines := strings.Split(output, "\n")
43+
lines := strings.Split(output, splitChars)
3744
for index, line := range lines {
3845
// skip title line
3946
if index == 0 {

0 commit comments

Comments
 (0)