[Qt-interest] QProcess & gpg
Bob Hood
bhood2 at comcast.net
Tue Dec 14 02:56:58 CET 2010
On 12/13/2010 6:18 PM, Anthony Gabrielson wrote:
> QString program = "gpg -e -r agabriel at ubuntu out.txt";
> //QString program = "pwd";
> QStringList arguments;
> //arguments << "-e" << "-r agabriel at ubuntu" << "out.txt";
>
> QProcess *myProcess = new QProcess(parent);
> myProcess->start(program, arguments);
Did you mean for 'arguments' to be empty? I'm pretty sure you'll need to have
the process name in 'program' and its arguments in 'arguments' for it to
function properly.
You might try merging the output channels in the process so you get stdout and
stderr via the same read:
myProcess->setProcessChannelMode(QProcess::MergedChannels);
myProcess->start(program, arguments);
You might also re-factor your waiting code to something like this and see if
that helps:
// Check to see if it even started correctly
if(!myProcess->waitForStarted())
{
// The process failed to start; handle the error here
...
return;
}
while(myProcess->state() == QProcess::Running)
myProcess->waitForFinished();
I use this sort of code under Windows all the time and it works perfectly (Qt
4.6.2).
Render me gone, |||
Bob ^(===)^
---------------------------------oOO--(_)--OOo---------------------------------
I never met a calorie I didn't like.
More information about the Qt-interest-old
mailing list