Checking and propagating tag_op_list_apply() errors is especially
important with batch tagging, as the processing of the batch input
would not stop otherwise. Additionally this sets the exit code, which
is useful in scripts.
Amended by: David Bremner
notmuch_query_t *query;
notmuch_messages_t *messages;
notmuch_message_t *message;
notmuch_query_t *query;
notmuch_messages_t *messages;
notmuch_message_t *message;
/* Optimize the query so it excludes messages that already have
* the specified set of tags. */
/* Optimize the query so it excludes messages that already have
* the specified set of tags. */
notmuch_messages_valid (messages) && ! interrupted;
notmuch_messages_move_to_next (messages)) {
message = notmuch_messages_get (messages);
notmuch_messages_valid (messages) && ! interrupted;
notmuch_messages_move_to_next (messages)) {
message = notmuch_messages_get (messages);
- tag_op_list_apply (message, tag_ops, flags | TAG_FLAG_PRE_OPTIMIZED);
+ ret = tag_op_list_apply (message, tag_ops, flags | TAG_FLAG_PRE_OPTIMIZED);
notmuch_message_destroy (message);
notmuch_message_destroy (message);
+ if (ret != NOTMUCH_STATUS_SUCCESS)
+ break;
}
notmuch_query_destroy (query);
}
notmuch_query_destroy (query);
+ return ret || interrupted;