I'm trying to execute a process as root from my application that runs with regular privileges using pkexec
.
When I invoke pkexec
synchronously everything is fine but when I run it asynchronously with the following code :
private void execute_process_async () {
if (permission.allowed ) {
...
Pid child_pid;
var cli = "%s/my_exec".printf (Build.PKGDATADIR);
try {
Process.spawn_async (null,
{ "pkexec", cli,
settings.scrollbar_width.to_string (),
settings.scrollbar_button_radius.to_string (),
settings.active_tab_underline_color
},
Environ.get (),
SpawnFlags.SEARCH_PATH,
null,
out child_pid);
} catch (SpawnError e) {
report_error ("error while executing '%s'. Message: '%s'.".printf (cli, e.message)) ;
}
}
}
I get an a rather grim error message:
Refusing to render service to dead parents.
Do you know what is happening?