1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-03 16:53:36 +03:00

Fix the ".read" command in the CLI so that SQLITE_OMIT_POPEN disables

reading from a pipeline.

FossilOrigin-Name: cea34f3cc35ad6dc67691799a219a30739f2296945d624d232bf76150c598ec0
This commit is contained in:
drh
2021-03-12 01:49:08 +00:00
parent ab6098cfa6
commit 9d59e3b1bf
3 changed files with 14 additions and 8 deletions

View File

@@ -9038,6 +9038,11 @@ static int do_meta_command(char *zLine, ShellState *p){
goto meta_command_exit;
}
if( azArg[1][0]=='|' ){
#ifdef SQLITE_OMIT_POPEN
raw_printf(stderr, "Error: pipes are not supported in this OS\n");
rc = 1;
p->out = stdout;
#else
p->in = popen(azArg[1]+1, "r");
if( p->in==0 ){
utf8_printf(stderr, "Error: cannot open \"%s\"\n", azArg[1]);
@@ -9046,6 +9051,7 @@ static int do_meta_command(char *zLine, ShellState *p){
rc = process_input(p);
pclose(p->in);
}
#endif
}else if( notNormalFile(azArg[1]) || (p->in = fopen(azArg[1], "rb"))==0 ){
utf8_printf(stderr,"Error: cannot open \"%s\"\n", azArg[1]);
rc = 1;