Fossil SCM
In the command-line shell, report if the ".system" command returns a non-zero result
Commit
bfacd6df6df60640af84e7809cfa1fc2fca73c7b
Parent
3a934617388aa51…
1 file changed
+3
-2
+3
-2
| --- src/shell.c | ||
| +++ src/shell.c | ||
| @@ -3124,11 +3124,11 @@ | ||
| 3124 | 3124 | |
| 3125 | 3125 | if( c=='s' |
| 3126 | 3126 | && (strncmp(azArg[0], "shell", n)==0 || strncmp(azArg[0],"system",n)==0) |
| 3127 | 3127 | ){ |
| 3128 | 3128 | char *zCmd; |
| 3129 | - int i; | |
| 3129 | + int i, x; | |
| 3130 | 3130 | if( nArg<2 ){ |
| 3131 | 3131 | fprintf(stderr, "Usage: .system COMMAND\n"); |
| 3132 | 3132 | rc = 1; |
| 3133 | 3133 | goto meta_command_exit; |
| 3134 | 3134 | } |
| @@ -3135,12 +3135,13 @@ | ||
| 3135 | 3135 | zCmd = sqlite3_mprintf(strchr(azArg[1],' ')==0?"%s":"\"%s\"", azArg[1]); |
| 3136 | 3136 | for(i=2; i<nArg; i++){ |
| 3137 | 3137 | zCmd = sqlite3_mprintf(strchr(azArg[i],' ')==0?"%z %s":"%z \"%s\"", |
| 3138 | 3138 | zCmd, azArg[i]); |
| 3139 | 3139 | } |
| 3140 | - (void)system(zCmd); | |
| 3140 | + x = system(zCmd); | |
| 3141 | 3141 | sqlite3_free(zCmd); |
| 3142 | + if( x ) fprintf(stderr, "System command returns %d\n", x); | |
| 3142 | 3143 | }else |
| 3143 | 3144 | |
| 3144 | 3145 | if( c=='s' && strncmp(azArg[0], "show", n)==0 ){ |
| 3145 | 3146 | int i; |
| 3146 | 3147 | if( nArg!=1 ){ |
| 3147 | 3148 |
| --- src/shell.c | |
| +++ src/shell.c | |
| @@ -3124,11 +3124,11 @@ | |
| 3124 | |
| 3125 | if( c=='s' |
| 3126 | && (strncmp(azArg[0], "shell", n)==0 || strncmp(azArg[0],"system",n)==0) |
| 3127 | ){ |
| 3128 | char *zCmd; |
| 3129 | int i; |
| 3130 | if( nArg<2 ){ |
| 3131 | fprintf(stderr, "Usage: .system COMMAND\n"); |
| 3132 | rc = 1; |
| 3133 | goto meta_command_exit; |
| 3134 | } |
| @@ -3135,12 +3135,13 @@ | |
| 3135 | zCmd = sqlite3_mprintf(strchr(azArg[1],' ')==0?"%s":"\"%s\"", azArg[1]); |
| 3136 | for(i=2; i<nArg; i++){ |
| 3137 | zCmd = sqlite3_mprintf(strchr(azArg[i],' ')==0?"%z %s":"%z \"%s\"", |
| 3138 | zCmd, azArg[i]); |
| 3139 | } |
| 3140 | (void)system(zCmd); |
| 3141 | sqlite3_free(zCmd); |
| 3142 | }else |
| 3143 | |
| 3144 | if( c=='s' && strncmp(azArg[0], "show", n)==0 ){ |
| 3145 | int i; |
| 3146 | if( nArg!=1 ){ |
| 3147 |
| --- src/shell.c | |
| +++ src/shell.c | |
| @@ -3124,11 +3124,11 @@ | |
| 3124 | |
| 3125 | if( c=='s' |
| 3126 | && (strncmp(azArg[0], "shell", n)==0 || strncmp(azArg[0],"system",n)==0) |
| 3127 | ){ |
| 3128 | char *zCmd; |
| 3129 | int i, x; |
| 3130 | if( nArg<2 ){ |
| 3131 | fprintf(stderr, "Usage: .system COMMAND\n"); |
| 3132 | rc = 1; |
| 3133 | goto meta_command_exit; |
| 3134 | } |
| @@ -3135,12 +3135,13 @@ | |
| 3135 | zCmd = sqlite3_mprintf(strchr(azArg[1],' ')==0?"%s":"\"%s\"", azArg[1]); |
| 3136 | for(i=2; i<nArg; i++){ |
| 3137 | zCmd = sqlite3_mprintf(strchr(azArg[i],' ')==0?"%z %s":"%z \"%s\"", |
| 3138 | zCmd, azArg[i]); |
| 3139 | } |
| 3140 | x = system(zCmd); |
| 3141 | sqlite3_free(zCmd); |
| 3142 | if( x ) fprintf(stderr, "System command returns %d\n", x); |
| 3143 | }else |
| 3144 | |
| 3145 | if( c=='s' && strncmp(azArg[0], "show", n)==0 ){ |
| 3146 | int i; |
| 3147 | if( nArg!=1 ){ |
| 3148 |