Hey there, im having a few issues trying to use QProcess to create a sub-process that runs GPG on the background.

I had previously implemented the functionality with windows specific methods, but since we are porting everything to Linux and Mac i thought it would be nice to let QProcess handle everything.

The problem is that the arguments that QProcess is building are not compatible with the type or argument GPG expects (GPG is pretty sensitive).
My code look like this:
Qt Code:
  1. QList<GPGKey> GPGKeyManagement::getKeys(GPGParameter *param)
  2. {
  3. QList<GPGKey> list;
  4.  
  5. args << "--homedir . --list-keys";
  6. //args << "--homedir . ";
  7. //args << " --list-keys ";
  8.  
  9. if (param)
  10. {
  11. // add the information specified in param to the args
  12. }
  13.  
  14. QProcess gpg;
  15. gpg.setProcessChannelMode(QProcess::MergedChannels);
  16. gpg.start("gpg.exe", args);
  17.  
  18. if (!gpg.waitForFinished())
  19. qDebug() << "Error: " << gpg.errorString();
  20. else
  21. {
  22. QString response(gpg.readAll());
  23. qDebug() << response;
  24. list = parseKeysFromOutput(response);
  25. }
  26.  
  27. return list;
  28. }
To copy to clipboard, switch view to plain text mode 

i also tried this, with no luck:
Qt Code:
  1. gpg.start("gpg.exe --homedir . --list-keys", args); //args empty
  2. or
  3. args << "gpg.exe --homedir . --list-keys";
  4. gpg.start("", args);
To copy to clipboard, switch view to plain text mode 

When Qt builds the command line it does 'gpg "--homedir . --list-keys" ' and so GPG complains about the double quotes added.
Was anyone able to call gpg from a QProcess in Windows?