On Fri, Sep 21 2018, Kristian Larsson wrote: > I am using mbsync together with mu and would like to run mu just after > mbsync if mbsync did any updates, like getting new email. How can I > determine this?
Use -e with the attached patch. I wrote a request some time ago and had some discussion with Oswald (if I'm not mistaken), but nothing official came out of it, so use at your own risk. https://sourceforge.net/p/isync/mailman/message/35620423/ I'm using exit codes to trigger reindexing with mu4e/notmuch and do heaver processing (such as scanning for spam) only necessary and without having to rescan huge folders.
commit 9279172f31d80742ae9e229b5b00e87557cbe556 Author: Yuri D'Elia <wav...@thregr.org> Date: 2017-07-15 23:36:43 +0200 Add -e for improved exit codes diff --git a/src/common.h b/src/common.h index c731126..7587ff2 100644 --- a/src/common.h +++ b/src/common.h @@ -85,6 +85,7 @@ typedef unsigned int uint; #define VERBOSE 0x800 #define KEEPJOURNAL 0x1000 #define ZERODELAY 0x2000 +#define EXITCODES 0x4000 extern int DFlags; extern int JLimit; diff --git a/src/main.c b/src/main.c index eadd81f..d58dddc 100644 --- a/src/main.c +++ b/src/main.c @@ -83,6 +83,7 @@ PACKAGE " " VERSION " - mailbox synchronizer\n" " -D, --debug debugging modes (see manual)\n" " -V, --verbose display what is happening\n" " -q, --quiet don't display progress counters\n" +" -e, --exitcodes use extended exit codes\n" " -v, --version display version\n" " -h, --help display this help message\n" "\nIf neither --pull nor --push are specified, both are active.\n" @@ -446,6 +447,8 @@ main( int argc, char **argv ) mvars->all = 1; else if (!strcmp( opt, "list" )) mvars->list = 1; + else if (!strcmp( opt, "exitcodes" )) + DFlags |= EXITCODES; else if (!strcmp( opt, "help" )) usage( 0 ); else if (!strcmp( opt, "version" )) @@ -690,6 +693,9 @@ main( int argc, char **argv ) case 'Z': DFlags |= ZERODELAY; break; + case 'e': + DFlags |= EXITCODES; + break; case 'v': version(); case 'h': @@ -756,6 +762,15 @@ main( int argc, char **argv ) main_loop(); if (!mvars->list) flushn(); + + if (DFlags & EXITCODES) { + int error = mvars->ret != 0; + int transient = 0; // TODO + int synced = new_done[0] || new_done[1] || + flags_done[0] || flags_done[1] || + trash_done[0] || trash_done[1]; + return error | (!synced << 2) | (transient << 3); + } return mvars->ret; }
_______________________________________________ isync-devel mailing list isync-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/isync-devel