Return code of offlineimap
Peter-Alexander Pöltl
peter.poeltl at gmail.com
Wed Feb 2 14:42:53 GMT 2011
Meanwhile I've added a second check if the error output is empty. Thank you
for approving that.
First I think your current solution was the right way. And without knowing
your code I think there's a solution you can relatively easy implement. You
probably know about this.
Summing errors bitwise. When asuming 8 bits it is possible to set 8
different bits to 0 or 1 thus displaying 8 different errors.
00000000 = 0 no error occurred
00000001 = 1 error 1 occurred
00000010 = 2 error 2 occurred
00000011 = 3 error 1 and 2 occurred
00000100 = 4 error 3 occurred
...
11111111 = 255 all 8 errors occurred
When using an 16 bit integer (what you probably do) you can even display 16
different errors independently. I've seen this on different linux programs.
So it is possible to check if the return value is 0 or if not take further
actions.
In detail you can probably leave most of the code as is and simply return
the error(s) to main where they are added bitwise together and are finally
displayed (returned) as an integer. Then it is possible to analyse this
return value in a script to identify the problems and take appropriate
actions.
Looping mode:
I think I don't have a real good answer to this.
As I mentioned I got this error because it wasn't possible to sync my
account (whatever the reason was). When I executed the same command from
terminal less than 10 seconds later it succeeded. So I guess the best
solution would be continuing and finishing everything else and (maybe with a
delay of a few seconds) retrying where errors occurred.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110202/0d8b3f20/attachment-0001.html>
More information about the OfflineIMAP-project
mailing list