Fossil SCM

If the -s option is used on the "fossil all command" and processing stops due to an error, print a clear error message so that the stop is unambiguous and does not get lost in the clutter of the "fossil all" output.

drh 2026-01-03 21:27 trunk
Commit b582c87727d98003b8a38d10180bf78afb46d0cbd46f48c3878441d46039df2a
1 file changed +12 -3
+12 -3
--- src/allrepo.c
+++ src/allrepo.c
@@ -167,10 +167,12 @@
167167
void all_cmd(void){
168168
Stmt q;
169169
const char *zCmd;
170170
char *zSyscmd;
171171
Blob extra;
172
+ int bHalted = 0;
173
+ int rc = 0;
172174
int useCheckouts = 0;
173175
int quiet = 0;
174176
int dryRunFlag = 0;
175177
int showFile = find_option("showfile",0,0)!=0;
176178
int stopOnError;
@@ -469,11 +471,10 @@
469471
" ORDER BY 1"
470472
);
471473
}
472474
db_prepare(&q,"SELECT name, tag, inode FROM repolist ORDER BY 1");
473475
while( db_step(&q)==SQLITE_ROW ){
474
- int rc;
475476
const char *zFilename = db_column_text(&q, 0);
476477
const char *zInode = db_column_text(&q,2);
477478
#if !USE_SEE
478479
if( sqlite3_strglob("*.efossil", zFilename)==0 ) continue;
479480
#endif
@@ -506,18 +507,21 @@
506507
if( !quiet || dryRunFlag ){
507508
fossil_print("%s\n", zSyscmd);
508509
fflush(stdout);
509510
}
510511
rc = dryRunFlag ? 0 : fossil_system(zSyscmd);
511
- free(zSyscmd);
512512
if( rc ){
513
- if( stopOnError ) break;
513
+ if( stopOnError ){
514
+ bHalted = 1;
515
+ break;
516
+ }
514517
/* If there is an error, pause briefly, but do not stop. The brief
515518
** pause is so that if the prior command failed with Ctrl-C then there
516519
** will be time to stop the whole thing with a second Ctrl-C. */
517520
sqlite3_sleep(330);
518521
}
522
+ fossil_free(zSyscmd);
519523
}
520524
db_finalize(&q);
521525
522526
blob_reset(&extra);
523527
@@ -532,6 +536,11 @@
532536
db_unprotect(PROTECT_CONFIG);
533537
db_multi_exec("%s", zSql /*safe-for-%s*/ );
534538
db_protect_pop();
535539
}
536540
}
541
+
542
+ if( stopOnError && bHalted ){
543
+ fossil_fatal("STOPPED: non-zero result code (%d) from\nSTOPPED: %s",
544
+ rc, zSyscmd);
545
+ }
537546
}
538547
--- src/allrepo.c
+++ src/allrepo.c
@@ -167,10 +167,12 @@
167 void all_cmd(void){
168 Stmt q;
169 const char *zCmd;
170 char *zSyscmd;
171 Blob extra;
 
 
172 int useCheckouts = 0;
173 int quiet = 0;
174 int dryRunFlag = 0;
175 int showFile = find_option("showfile",0,0)!=0;
176 int stopOnError;
@@ -469,11 +471,10 @@
469 " ORDER BY 1"
470 );
471 }
472 db_prepare(&q,"SELECT name, tag, inode FROM repolist ORDER BY 1");
473 while( db_step(&q)==SQLITE_ROW ){
474 int rc;
475 const char *zFilename = db_column_text(&q, 0);
476 const char *zInode = db_column_text(&q,2);
477 #if !USE_SEE
478 if( sqlite3_strglob("*.efossil", zFilename)==0 ) continue;
479 #endif
@@ -506,18 +507,21 @@
506 if( !quiet || dryRunFlag ){
507 fossil_print("%s\n", zSyscmd);
508 fflush(stdout);
509 }
510 rc = dryRunFlag ? 0 : fossil_system(zSyscmd);
511 free(zSyscmd);
512 if( rc ){
513 if( stopOnError ) break;
 
 
 
514 /* If there is an error, pause briefly, but do not stop. The brief
515 ** pause is so that if the prior command failed with Ctrl-C then there
516 ** will be time to stop the whole thing with a second Ctrl-C. */
517 sqlite3_sleep(330);
518 }
 
519 }
520 db_finalize(&q);
521
522 blob_reset(&extra);
523
@@ -532,6 +536,11 @@
532 db_unprotect(PROTECT_CONFIG);
533 db_multi_exec("%s", zSql /*safe-for-%s*/ );
534 db_protect_pop();
535 }
536 }
 
 
 
 
 
537 }
538
--- src/allrepo.c
+++ src/allrepo.c
@@ -167,10 +167,12 @@
167 void all_cmd(void){
168 Stmt q;
169 const char *zCmd;
170 char *zSyscmd;
171 Blob extra;
172 int bHalted = 0;
173 int rc = 0;
174 int useCheckouts = 0;
175 int quiet = 0;
176 int dryRunFlag = 0;
177 int showFile = find_option("showfile",0,0)!=0;
178 int stopOnError;
@@ -469,11 +471,10 @@
471 " ORDER BY 1"
472 );
473 }
474 db_prepare(&q,"SELECT name, tag, inode FROM repolist ORDER BY 1");
475 while( db_step(&q)==SQLITE_ROW ){
 
476 const char *zFilename = db_column_text(&q, 0);
477 const char *zInode = db_column_text(&q,2);
478 #if !USE_SEE
479 if( sqlite3_strglob("*.efossil", zFilename)==0 ) continue;
480 #endif
@@ -506,18 +507,21 @@
507 if( !quiet || dryRunFlag ){
508 fossil_print("%s\n", zSyscmd);
509 fflush(stdout);
510 }
511 rc = dryRunFlag ? 0 : fossil_system(zSyscmd);
 
512 if( rc ){
513 if( stopOnError ){
514 bHalted = 1;
515 break;
516 }
517 /* If there is an error, pause briefly, but do not stop. The brief
518 ** pause is so that if the prior command failed with Ctrl-C then there
519 ** will be time to stop the whole thing with a second Ctrl-C. */
520 sqlite3_sleep(330);
521 }
522 fossil_free(zSyscmd);
523 }
524 db_finalize(&q);
525
526 blob_reset(&extra);
527
@@ -532,6 +536,11 @@
536 db_unprotect(PROTECT_CONFIG);
537 db_multi_exec("%s", zSql /*safe-for-%s*/ );
538 db_protect_pop();
539 }
540 }
541
542 if( stopOnError && bHalted ){
543 fossil_fatal("STOPPED: non-zero result code (%d) from\nSTOPPED: %s",
544 rc, zSyscmd);
545 }
546 }
547

Keyboard Shortcuts

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