Handling SIGPIPE error in snakemake

后端 未结 2 607
感动是毒
感动是毒 2021-01-14 01:40

The following snakemake script:

rule all:
    input:
        \'test.done\'

rule pipe:
   output:
       \'test.done\'
   shell:
        \"\"\"
        seq 1         


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-14 02:20

    A somehow clunky solution is to append || true to the script. This will make the command always exit cleanly, which is not acceptable. To check whether the script actually succeded you can query the array variable ${PIPESTATUS[@]} to ensure it contains the expected exit codes:

    This script is ok:

    seq 1 10000 | head | grep 1 > test.done || true
    echo ${PIPESTATUS[@]}
    141 0 0
    

    This is not ok:

    seq 1 10000 | head | FOOBAR > test.done || true
    echo ${PIPESTATUS[@]}
    0
    

提交回复
热议问题