diff --git a/printer/dataset_printer.go b/printer/dataset_printer.go index 4e7dffd..1e165be 100644 --- a/printer/dataset_printer.go +++ b/printer/dataset_printer.go @@ -70,15 +70,13 @@ func (p *DataSetPrinter) PrintDataSet(res *nebula.ResultSet) { fmt.Println(p.writer.Render()) if p.fd != nil { - go func() { - s := strings.Replace(p.writer.RenderCSV(), "\\\"", "", -1) - fmt.Fprintln(p.fd, s) + s := strings.Replace(p.writer.RenderCSV(), "\\\"", "", -1) + fmt.Fprintln(p.fd, s) - if err := p.fd.Close(); err != nil { - fmt.Printf("Close file %s failed, %s", p.filename, err.Error()) - } - p.fd = nil - p.filename = "" - }() + if err := p.fd.Close(); err != nil { + fmt.Printf("Close file %s failed, %s", p.filename, err.Error()) + } + p.fd = nil + p.filename = "" } }