On Sat, Mar 09, 2019 at 09:42:57PM EST, Derek Schrock wrote: > However, there appears to be a race issue with the callback method. > While trying to test the value string to see if it's second word is > "tty" pinentry would execute before endwin. I simulated this with a > sleep() before endwin. So using the callback might not work here or am > I doing something wrong here?
Forgot the example patch. Without the sleep everything seems alright but that might just be luck. So depending on the system or the state of the system pinentry might run before endwin.
diff --git a/crypt-gpgme.c b/crypt-gpgme.c index 1ec05497..b170dbaa 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -375,6 +375,15 @@ static int crypt_id_matches_addr (ADDRESS *addr, ADDRESS *u_addr, return rv; } +static gpg_error_t +status_cb (void *opaque, const char *keyword, const char *value) +{ + if(mutt_strcmp(keyword, "PINENTRY_LAUNCHED") == 0) { + //sleep(2); + endwin(); + } + return 0; +} /* * GPGME convenient functions. @@ -406,7 +415,8 @@ static gpgme_ctx_t create_gpgme_context (int for_smime) mutt_exit (1); } } - + gpgme_set_status_cb (ctx, status_cb, NULL); + gpgme_set_ctx_flag (ctx, "full-status", "1"); return ctx; }