$ gpg --version gpg (GnuPG) 2.4.6-beta102 libgcrypt 1.11.1-beta31 $ gpg --status-fd 2 --export-secret-keys 98111E67AE06F2BEFD2BDE10C5D6C919005F36A4 gpg: NOTE: THIS IS A DEVELOPMENT VERSION! gpg: It is only intended for test purposes and should NOT be gpg: used in a production environment or with production keys! [GNUPG:] KEY_CONSIDERED 98111E67AE06F2BEFD2BDE10C5D6C919005F36A4 0 [GNUPG:] PINENTRY_LAUNCHED 88217 qt 1.3.2-beta4 /dev/pts/24 xterm-256color :0 20600/1000/5 1000/1000 0
-> pinentry is shown -> click Cancel
gpg: key 7A62F95F55D026E06FD7449D6830D395AB44665E: error receiving key from agent: Operation cancelled - skipped gpg: WARNING: nothing exported [GNUPG:] EXPORT_RES 1 1 0 [GNUPG:] FAILURE gpg-exit 33554433
gpg does not emit a status log reporting the canceled operation, so that gpgme doesn't know that the operation was canceled.
Instead gpg emits a failure with code 33554433 = (GnuPG, General error).
I acknowledge that it's not that easy to fix because if multiple keys are exported then some but not all password prompts might be canceled.
In any case, existing with a General error seems wrong. If all password prompts are canceled then I'd expect a Canceled error. Or (maybe easier) no error/failure at all so that the caller can deduce a likely canceled operation from the empty export result (count/secret_count > 0, exported == 0).