diff --git a/CHANGES.md b/CHANGES.md index dcf2a3f..681b469 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +v0.2.21 (dev) +======= ++ hts/vcf allow setting id. ++ hts/vcf flush stdout on close. + v0.2.20 ======= + hts/files (iterate over bgzipped or text files identically) diff --git a/src/hts/vcf.nim b/src/hts/vcf.nim index b21a81a..b2c0446 100644 --- a/src/hts/vcf.nim +++ b/src/hts/vcf.nim @@ -416,6 +416,9 @@ proc newVariant*(): Variant = new(result, destroy_variant) result.c = bcf_init() +proc c_fflush(f: File): cint {. + importc: "fflush", header: "", discardable.} + proc destroy_vcf(v:VCF) = bcf_hdr_destroy(v.header.hdr) if v.tidx != nil: @@ -434,6 +437,8 @@ proc close*(v:VCF) = when defined(debug): stderr.write_line "[hts-nim] error closing vcf" v.hts = nil + if v.fname in ["/dev/stdout", "-"]: + c_fflush(stdout) proc copy_header*(v: var VCF, hdr: Header) =