|
From: Bastian M. <bma...@we...> - 2014-02-23 14:31:23
|
Am 23.02.2014 04:46, schrieb Daniel J Sebald:
> On 02/22/2014 11:45 AM, Jérôme Lodewyck wrote:
>> 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.
>
> Oh yeah; gnuplot_qt could stop somehow. I'll watch for that.
>
>
>> Also, for the -persist option to work, the process should not be
>> deleted at exit.
>
> OK, good. I'll try to figure out how to change a QProcess to persistent.
Hhhm. I am currently unaware of a Windows API to change a process to the
"detached" state. If there is indeed such a thing, this could also help
to finally implement -persist properly on Windows for all interactive
terminals.
Bastian
>
> Thanks,
>
> Dan
>
>
>>
>> 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
>>
>>
>
|