Fossil SCM

In the command-line shell, report if the ".system" command returns a non-zero result

jan.nijtmans 2014-08-07 10:59 trunk
Commit bfacd6df6df60640af84e7809cfa1fc2fca73c7b
1 file changed +3 -2
+3 -2
--- src/shell.c
+++ src/shell.c
@@ -3124,11 +3124,11 @@
31243124
31253125
if( c=='s'
31263126
&& (strncmp(azArg[0], "shell", n)==0 || strncmp(azArg[0],"system",n)==0)
31273127
){
31283128
char *zCmd;
3129
- int i;
3129
+ int i, x;
31303130
if( nArg<2 ){
31313131
fprintf(stderr, "Usage: .system COMMAND\n");
31323132
rc = 1;
31333133
goto meta_command_exit;
31343134
}
@@ -3135,12 +3135,13 @@
31353135
zCmd = sqlite3_mprintf(strchr(azArg[1],' ')==0?"%s":"\"%s\"", azArg[1]);
31363136
for(i=2; i<nArg; i++){
31373137
zCmd = sqlite3_mprintf(strchr(azArg[i],' ')==0?"%z %s":"%z \"%s\"",
31383138
zCmd, azArg[i]);
31393139
}
3140
- (void)system(zCmd);
3140
+ x = system(zCmd);
31413141
sqlite3_free(zCmd);
3142
+ if( x ) fprintf(stderr, "System command returns %d\n", x);
31423143
}else
31433144
31443145
if( c=='s' && strncmp(azArg[0], "show", n)==0 ){
31453146
int i;
31463147
if( nArg!=1 ){
31473148
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button