[Qt-interest] QProcess & gpg

Anthony Gabrielson agabrielson1 at comcast.net
Tue Dec 14 02:41:29 CET 2010


Problem solved and it was in fact obvious...

On Dec 13, 2010, at 8:18 PM, Anthony Gabrielson wrote:

> Hello,
> 	I'm trying to work through an issue I'm having with QProcess & gpg and I'm hoping I'm doing something wrong thats obvious; but other commands like ls or pwd work.  Anyway, I have some sample code and I'm calling gpg with a few options.  The command works great from command line, but isn't working at all from within my sample app. 
> 
> Here is the code:
> 
> MainWindow::MainWindow(QWidget *parent)
>    : QMainWindow(parent)
> {
>    Editor  *edit = new Editor(this);
>    setCentralWidget(edit);
> 
>    QString appPath = qApp->applicationDirPath();
> 
>    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);
>    //myProcess->execute(program);
>    myProcess->waitForFinished(-1);
> 
>    edit->newCmd(QString("cmd: ").append(program));
> 
>    if(myProcess->exitStatus() == QProcess::NormalExit)
>        edit->newCmd("GPG: Normal Exit");
> 
>    if(myProcess->state() == QProcess::NotRunning)
>        edit->newCmd("GPG: not running");
> 
>    QString data = myProcess->readAllStandardError();
>    edit->newCmd(QString("ERR output: ").append(data));
> 
>    data = myProcess->readAllStandardOutput();
>    edit->newCmd(QString("IO output: ").append(data));
> 
>    data = myProcess->readAll();
>    edit->newCmd(QString("All output: ").append(data));
> }
> 
> Here is the output:
> 
> cmd: gpg -e -r agabriel at ubuntu out.txt
> GPG: Normal Exit
> GPG: not running
> ERR output: 
> IO output: 
> All output: 
> 
> Any ideas why this isn't working?
> 
> Thanks,
> Anthony
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest





More information about the Qt-interest-old mailing list