compact json and add \n delimiter for d4 piping
parent
c779f589fe
commit
8fdae4a7d1
14
d4-tlsf.go
14
d4-tlsf.go
|
@ -463,11 +463,17 @@ func output(t d4tls.TLSSession) {
|
|||
} else {
|
||||
panic(fmt.Sprintf("./%s does not exist", *outJSON))
|
||||
}
|
||||
// If not folder specidied, we output to stdout
|
||||
// If not folder specified, we output to stdout
|
||||
} else {
|
||||
r := bytes.NewReader(jsonRecord)
|
||||
_, err := io.Copy(os.Stdout, r)
|
||||
if err != nil {
|
||||
var buf bytes.Buffer
|
||||
if err := json.Compact(&buf, jsonRecord); err != nil {
|
||||
fmt.Println("Failed to compact json output")
|
||||
}
|
||||
if _, err := buf.Write([]byte{0x0A}); err != nil {
|
||||
fmt.Println("Could not append delimiter")
|
||||
}
|
||||
|
||||
if _, err := io.Copy(os.Stdout, &buf); err != nil {
|
||||
panic("Could not write to stdout.")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue