[Development] Deprecating the static QProcess::startDetached() overloads

J-P Nurmi jpnurmi at gmail.com
Wed Feb 27 07:59:12 CET 2019


On Wed, Feb 27, 2019, 07:35 Simon Hausmann <Simon.Hausmann at qt.io> wrote:

> I’m in favor of deprecating the static overloads. Compilers give nice
> deprecating warnings these days and the non-deprecated interface remains
> nice and clear.
>
> Just my two cents,
> Simon
>
> > On 27. Feb 2019, at 02:56, Thiago Macieira <thiago.macieira at intel.com>
> wrote:
> >
> > With a lot of thanks to Jörg's effort, since Qt 5.9 we have a non-static
> > startDetached() method, which do honour the environment set with
> > setProcessEnvironment, the current working dir with setWorkingDirectory,
> etc.
> >
> > I think it's a far superior option. By far, it avoids the mistake that
> led to
> > QTBUG-74074, where someone wrote:
> >
> >    QProcess exeB;
> >    QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
> >    env.insert("PYTHONHOME", "NewVariable");
> >    exeB.setProcessEnvironment(env);
> >    exeB.startDetached("AnotherProcess/AnotherProcess.exe");
> >
> > Unfortunately, that startDetached is static, so the setting made in the
> object
> > are not relevant. The author needed to write:
> >
> >    exeB.setProgram("AnotherProcess/AnotherProcess.exe");
> >    exeB.startDetached();
> >
> > Ok to deprecate it?
> >
> > We will not be able to recover those overloads in Qt 6, but we may be
> able to
> > bring them back in Qt 7.
> >
> > Alternative: deprecate *ALL* startDetached() overloads and instead add a
> > setDetachedMode(bool enable), and allow start() to start detachedly.
>

Is it technically possible to start() and then detach()?

QProcess process;
process.setFoo(...);
process.start(...);
process.waitForBar();
process.read(...);
process.detach();

--
J-P Nurmi

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20190227/749bd959/attachment.html>


More information about the Development mailing list