Skip to content

Commit a3b1ff2

Browse files
pixgeAndrea Mugellini
and
Andrea Mugellini
authored
doc: channel response before return (#134)
Co-authored-by: Andrea Mugellini <[email protected]>
1 parent 603e780 commit a3b1ff2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

doc.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func ConvertDoc(r io.Reader) (string, map[string]string, error) {
3636
doc, err := mscfb.New(f)
3737
if err != nil {
3838
log.Printf("ConvertDoc: could not read doc: %v", err)
39+
mc <- meta
3940
return
4041
}
4142

@@ -75,10 +76,12 @@ func ConvertDoc(r io.Reader) (string, map[string]string, error) {
7576
go func() {
7677

7778
// Save output to a file
79+
var buf bytes.Buffer
7880
outputFile, err := ioutil.TempFile("/tmp", "sajari-convert-")
7981
if err != nil {
8082
// TODO: Remove this.
8183
log.Println("TempFile Out:", err)
84+
bc <- buf.String()
8285
return
8386
}
8487
defer os.Remove(outputFile.Name())
@@ -89,7 +92,6 @@ func ConvertDoc(r io.Reader) (string, map[string]string, error) {
8992
log.Println("wvText:", err)
9093
}
9194

92-
var buf bytes.Buffer
9395
_, err = buf.ReadFrom(outputFile)
9496
if err != nil {
9597
// TODO: Remove this.

0 commit comments

Comments
 (0)