Closed anderspitman closed 1 year ago
I don't understand what is the problem. This seems to work alright
$ cat test.sh
#!/bin/bash
set -eo pipefail
bcftools view test.vcf | head -1
echo "done"
$ ./test.sh
##fileformat=VCFv4.2
done
I believe this is resolved, please complain if not
To reproduce:
bcftools view <vcf with more than 5 lines> | head -n 5
After head finishes processing 5 lines and exits, bcftools will attempt to continue writing to the pipe and receive
SIGPIPE
from the OS, and exit with code 141. This breaks scripts that useset -eo pipefail
.Background info:
https://stackoverflow.com/questions/19120263/why-exit-code-141-with-grep-q
https://github.com/samtools/samtools/issues/1567
http://www.pixelbeat.org/programming/sigpipe_handling.html