|
From: Jérôme L. <lod...@us...> - 2014-02-22 17:45:40
|
I think it is fine to create the process as non-detached. We should just make
sure a new process is started (and without leaking memory) if the previous one
is killed. Also, for the -persist option to work, the process should not be
deleted at exit.
Jérôme
Le samedi 22 février 2014 10:55:39 Daniel J Sebald a écrit :
> It's fairly simple, really. But first, I'd like to ask if it is alright
> to create the process not as detached, but just a normal process. Is
> that OK? If that is done, then after starting the QProcess that will
> create the local server, just wait for the process to write back the
> server's name and continue onward. By writing the local server name to
> standard output (fprint/fflush) when everything is set up and ready to
> go, the first time that qt_term attempts to connect to the local server
> will be a success.
>
>
> IN QT_TERM.CPP:
>
> if (!qtgnuplotProcess)
> qtgnuplotProcess = new QProcess();
> qtgnuplotProcess->start(filename, QStringList());
> if (qtgnuplotProcess->waitForStarted())
> {
> qtgnuplotProcess->waitForReadyRead();
> localServerName = qtgnuplotProcess->readAllStandardOutput();
> qDebug() << localServerName;
> }
> else
> {
> qDebug() << "QProcess starting failed:" <<
> qtgnuplotProcess->errorString();
> }
>
>
> IN QTGNUPLOTAPPLICATION.CPP:
>
> QtGnuplotApplication::QtGnuplotApplication(int& argc, char** argv)
>
> : QApplication(argc, argv)
>
> {
> ...
> connect(m_eventHandler, SIGNAL(disconnected()), this,
> SLOT(enterPersistMode()));
>
> fprintf(stdout, sName.toLocal8Bit().data());
> fflush(stdout);
> }
>
> Dan
|