[solved] (kind of) Re: Detect if polkit user-agent is running
On Sun, 1 Apr 2018 19:01:47 +0200
Michael Lange <klappnase@freenet.de> wrote:
> Hi,
>
> is there any way to detect if a policykit user-agent is running before
> actually calling pkexec to display the dialog with the login prompt?
>
> >From the pkexec man page it looks like calling
>
> pkexec --disable-internal-agent <command>
>
> should be sufficient as test, since the exit code 127 should tell me no
> user-agent is running. However here with lxpolkit I also get the "127"
> when the user hits the "Cancel" button, so this does not seem to be
> reliable.
> So, does anyone know if it is possible to check the presence of the
> user-agent before I actually call pkexec?
>
> Best regards
>
> Michael
After reading some more I now believe this is a bug in lxpolkit and filed
a bug report. The mate and Gnome polkit agents deliver the expected 126
exit code when login is cancelled (though the lxqt counterpart, not much
surprisingly, also gives a 127, as does the KDE agent (but bugs in KDE
never surprise me much either)).
For now I guess I will have to settle with a somewhat ambiguous error
message, like "No user-agent running or login was cancelled" :)
Regards
Michael
.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
If some day we are defeated, well, war has its fortunes, good and bad.
-- Commander Kor, "Errand of Mercy", stardate 3201.7
Reply to: