diff options
author | Ingo Klöcker <[email protected]> | 2024-01-09 10:22:43 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2024-01-09 10:22:43 +0000 |
commit | 85c7a94d635d1eb134a51fb6d1ab4dc400a8fc1c (patch) | |
tree | 3f992bd49b0e6bdbc159c480ef840fc54f5bf31b | |
parent | qt: Pass home directory with forward slashes when launching dirmngr (diff) | |
download | gpgme-85c7a94d635d1eb134a51fb6d1ab4dc400a8fc1c.tar.gz gpgme-85c7a94d635d1eb134a51fb6d1ab4dc400a8fc1c.zip |
cpp,tests: Launch dirmngr with gpg-conf
* lang/cpp/tests/run-wkdlookup.cpp (main): Replace backslashes with
forward slashes in homedir returned by GpgME::dirInfo. Use "gpgconf
--launch dirmngr" to start dirmngr.
--
With this change the same code as by QGpgMEWKDLookupJob is again used to
launch dirmngr. It also fixes the bad example of starting dirmngr
without the help of gpgconf.
GnuPG-bug-id: 6833
-rw-r--r-- | lang/cpp/tests/run-wkdlookup.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lang/cpp/tests/run-wkdlookup.cpp b/lang/cpp/tests/run-wkdlookup.cpp index e094ab05..4a3966b0 100644 --- a/lang/cpp/tests/run-wkdlookup.cpp +++ b/lang/cpp/tests/run-wkdlookup.cpp @@ -103,19 +103,22 @@ main (int argc, char **argv) return -1; } - const auto dirmngrProgram = GpgME::dirInfo("dirmngr-name"); - const auto homedir = GpgME::dirInfo("homedir"); + const auto gpgconfProgram = GpgME::dirInfo("gpgconf-name"); + // replace backslashes with forward slashes in homedir to work around bug T6833 + std::string homedir{GpgME::dirInfo("homedir")}; + std::replace(homedir.begin(), homedir.end(), '\\', '/'); const char *argv[] = { - dirmngrProgram, + gpgconfProgram, "--homedir", - homedir, - "--daemon", + homedir.c_str(), + "--launch", + "dirmngr", NULL }; auto ignoreIO = Data{Data::null}; - err = spawnCtx->spawnAsync(dirmngrProgram, argv, - ignoreIO, ignoreIO, ignoreIO, - Context::SpawnDetached); + err = spawnCtx->spawn(gpgconfProgram, argv, + ignoreIO, ignoreIO, ignoreIO, + Context::SpawnDetached); if (err) { std::cerr << "Failed to start dirmngr (Error: " << err.asString() << ")\n"; return -1; |