Skip to content

Commit fe87cff

Browse files
committed
govc: host.info: use writer instead of os.stdout
Closes: #2995
1 parent a7196e4 commit fe87cff

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

govc/flags/output.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,14 @@ func (flag *OutputFlag) Write(b []byte) (int, error) {
106106
return 0, nil
107107
}
108108

109-
n, err := os.Stdout.Write(b)
110-
os.Stdout.Sync()
109+
w := flag.Out
110+
if w == nil {
111+
w = os.Stdout
112+
}
113+
n, err := w.Write(b)
114+
if w == os.Stdout {
115+
os.Stdout.Sync()
116+
}
111117
return n, err
112118
}
113119

0 commit comments

Comments
 (0)