AW: AW: Cancel operation does not return error code

Schultschik, Sven sven.schultschik at siemens.com
Wed Mar 16 17:22:29 CET 2022


> > I'm using the Cancel methods on ctrl+c but the terminal is anyway messed up.
> > Would it be worth a bug report?
>
> No. The pinentry is background process and there is no portable way to save and restore the screen.  Thus your application may want to do something like this after a gpgme operation:
>
>   if ((s = gpgme_get_ctx_flag (ctx, "redraw")) && *s)
>     fputs ("Screen redraw suggested\n", stdout);
>

I implemented as suggested. And yes this makes it possible to type again, but the pinentry still running in the background and if you hit enter two times it comes back and the terminal acts weird. See screenshots

gpgme_error_t err = gpgme_cancel(_ctx);
const char* s;
if (( s = gpgme_get_ctx_flag (_ctx, "redraw")) && *s)
      if (!system("reset"))
            log(LOG_ERR, "Could not reset terminal. Reset Terminal suggested");
fail_if_err(err);
 _ctx = gpgme_wait(_ctx, &err, false);
 fail_if_err(err);
 gpgme_release(_ctx);

There must be a possibility to proper kill the pinentry

Regards

Sven
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2022-03-16 17_18_25-ICEdge - VMware Workstation.png
Type: image/png
Size: 17384 bytes
Desc: 2022-03-16 17_18_25-ICEdge - VMware Workstation.png
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20220316/da713aef/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2022-03-16 17_19_10-ICEdge - VMware Workstation.png
Type: image/png
Size: 51436 bytes
Desc: 2022-03-16 17_19_10-ICEdge - VMware Workstation.png
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20220316/da713aef/attachment-0003.png>


More information about the Gnupg-users mailing list