1
0

fix: getting gpg-agent to start automatically on macOS

This commit is contained in:
saturneric 2024-11-30 22:15:56 +01:00
parent 62c4c40a59
commit d027dfaefb

View File

@ -120,20 +120,23 @@ void GpgFrontend::GpgAdvancedOperator::RestartGpgComponents() {
FLOG_D("gpgconf --kill --all execute result: %d", success); FLOG_D("gpgconf --kill --all execute result: %d", success);
if (!success) { if (!success) {
FLOG_W("restart all component after core initilized failed"); FLOG_W("restart all component after core initalized failed");
Module::UpsertRTValue( Module::UpsertRTValue(
"core", "gpg_advanced_operator.restart_gpg_components", false); "core", "gpg_advanced_operator.restart_gpg_components", false);
return; return;
} }
// StartGpgAgent([](int err, DataObjectPtr) { #if defined(__APPLE__) && defined(__MACH__)
// if (err >= 0) { FLOG_I("getting gpg-agent to start automatically on macOS");
// Module::UpsertRTValue( #else
// "core", "gpg_advanced_operator.restart_gpg_components", StartGpgAgent([](int err, DataObjectPtr) {
// true); if (err >= 0) {
// return; Module::UpsertRTValue(
// } "core", "gpg_advanced_operator.restart_gpg_components", true);
// }); return;
}
});
#endif
}}); }});
} }
@ -176,7 +179,7 @@ void GpgFrontend::GpgAdvancedOperator::StartGpgAgent(OperationCallback cb) {
GpgFrontend::GpgCommandExecutor::ExecuteSync( GpgFrontend::GpgCommandExecutor::ExecuteSync(
{gpg_agent_path, QStringList{"--homedir", home_path, "--daemon"}, {gpg_agent_path, QStringList{"--homedir", home_path, "--daemon"},
[=](int exit_code, const QString &, const QString &) { [=](int exit_code, const QString &, const QString &) {
FLOG_D("gpgconf daemon exit code: %d", exit_code); FLOG_D("gpg-agent daemon exit code: %d", exit_code);
cb(exit_code >= 0 ? 0 : -1, TransferParams()); cb(exit_code >= 0 ? 0 : -1, TransferParams());
}}); }});
} }