Closed pb-cdunn closed 8 years ago
In our fork, I've fixed this by calling a fatal empty input file an error:
$ git diff
diff --git fasta2DB.c fasta2DB.c
index b080fb5..77ad132 100644
--- fasta2DB.c
+++ fasta2DB.c
@@ -395,10 +395,10 @@ int main(int argc, char *argv[])
nline = 1;
eof = (fgets(read,MAX_NAME,input) == NULL);
if (eof || strlen(read) < 1)
- { fprintf(stderr,"Skipping '%s', file is empty!\n",core);
+ { fprintf(stderr,"'%s', file is empty!\n",core);
fclose(input);
free(core);
- continue;
+ goto error;
}
Gene, look at the markdown for this comment by clicking on the "pencil icon". It looks like this:
```diff
$ git diff
diff --git fasta2DB.c fasta2DB.c
...
The word "diff" after the triple backticks tells GitHub the language to format. I thought you might be pleased to see that it supports your own "diff" output as a format. :smile:
Rather than change behavior, which was to simply skip empty files, I just test if the input is stdin and if so exit the loop. This way it doesn't loop, you just get an empty database.
Excellent. Thank you.
Use-case:
In other words, when the input is accidentally not zipped, that program never ends, so our whole assembly pipeline hangs.