Index: src/shell.c ================================================================== --- src/shell.c +++ src/shell.c @@ -107,19 +107,27 @@ # endif # undef popen # define popen _popen # undef pclose # define pclose _pclose +# if !defined(SQLITE_POPEN_MODE) && defined(_MSC_VER) +# define SQLITE_POPEN_MODE "b" +# else +# define SQLITE_POPEN_MODE "" +# endif #else /* Make sure isatty() has a prototype. */ extern int isatty(int); # if !defined(__RTP__) && !defined(_WRS_KERNEL) /* popen and pclose are not C89 functions and so are ** sometimes omitted from the header */ extern FILE *popen(const char*,const char*); extern int pclose(FILE*); +# ifndef SQLITE_POPEN_MODE +# define SQLITE_POPEN_MODE "" +# endif # else # define SQLITE_OMIT_POPEN 1 # endif #endif @@ -3002,11 +3010,11 @@ if( sCtx.zFile[0]=='|' ){ #ifdef SQLITE_OMIT_POPEN fprintf(stderr, "Error: pipes are not supported in this OS\n"); return 1; #else - sCtx.in = popen(sCtx.zFile+1, "r"); + sCtx.in = popen(sCtx.zFile+1, "r" SQLITE_POPEN_MODE); sCtx.zFile = ""; xCloser = pclose; #endif }else{ sCtx.in = fopen(sCtx.zFile, "rb"); @@ -3390,11 +3398,11 @@ #ifdef SQLITE_OMIT_POPEN fprintf(stderr,"Error: pipes are not supported in this OS\n"); rc = 1; p->out = stdout; #else - p->out = popen(zFile + 1, "w"); + p->out = popen(zFile + 1, "w" SQLITE_POPEN_MODE); if( p->out==0 ){ fprintf(stderr,"Error: cannot open pipe \"%s\"\n", zFile + 1); p->out = stdout; rc = 1; }else{