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
This commit is contained in:
parent
7e520213c0
commit
85c7a94d63
@ -103,19 +103,22 @@ main (int argc, char **argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto dirmngrProgram = GpgME::dirInfo("dirmngr-name");
|
const auto gpgconfProgram = GpgME::dirInfo("gpgconf-name");
|
||||||
const auto homedir = GpgME::dirInfo("homedir");
|
// 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[] = {
|
const char *argv[] = {
|
||||||
dirmngrProgram,
|
gpgconfProgram,
|
||||||
"--homedir",
|
"--homedir",
|
||||||
homedir,
|
homedir.c_str(),
|
||||||
"--daemon",
|
"--launch",
|
||||||
|
"dirmngr",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
auto ignoreIO = Data{Data::null};
|
auto ignoreIO = Data{Data::null};
|
||||||
err = spawnCtx->spawnAsync(dirmngrProgram, argv,
|
err = spawnCtx->spawn(gpgconfProgram, argv,
|
||||||
ignoreIO, ignoreIO, ignoreIO,
|
ignoreIO, ignoreIO, ignoreIO,
|
||||||
Context::SpawnDetached);
|
Context::SpawnDetached);
|
||||||
if (err) {
|
if (err) {
|
||||||
std::cerr << "Failed to start dirmngr (Error: " << err.asString() << ")\n";
|
std::cerr << "Failed to start dirmngr (Error: " << err.asString() << ")\n";
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user