mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Patch a bug on writing to stdout, and add clearer error on openning data files
This commit is contained in:
@ -21,11 +21,21 @@ func WriteSeqFileChunk(
|
||||
toBePrinted := make(map[int]SeqFileChunk)
|
||||
for chunk := range chunk_channel {
|
||||
if chunk.Order == nextToPrint {
|
||||
_, _ = writer.Write(chunk.Raw.Bytes())
|
||||
log.Debugf("Writing chunk: %d of length %d bytes",
|
||||
chunk.Order,
|
||||
len(chunk.Raw.Bytes()))
|
||||
|
||||
n, err := writer.Write(chunk.Raw.Bytes())
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Cannot write chunk %d only %d bytes written on %d sended : %v",
|
||||
chunk.Order, n, len(chunk.Raw.Bytes()), err)
|
||||
}
|
||||
nextToPrint++
|
||||
|
||||
chunk, ok := toBePrinted[nextToPrint]
|
||||
for ok {
|
||||
log.Debug("Writing buffered chunk : ", chunk.Order)
|
||||
_, _ = writer.Write(chunk.Raw.Bytes())
|
||||
delete(toBePrinted, nextToPrint)
|
||||
nextToPrint++
|
||||
@ -36,6 +46,7 @@ func WriteSeqFileChunk(
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("FIle have to be closed : %v", toBeClosed)
|
||||
if toBeClosed {
|
||||
err := writer.Close()
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user