(OP here) I seem to have solved it this way: ``` --- src/shell.c.in +++ src/shell.c.in @@ -7845,10 +7845,11 @@ rc = 1; } }else if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){ + while (fgetc(p->in) != EOF); if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc); rc = 2; }else ``` The line numbers correspond to my modified version so they may not match official source. But it's in that vicinity. As I have no knowledge of SQLite3 internals, can someone verify if this seems correct solution?