In Qt4, there is QProcess::setProcessEnvironment() for setting Env variables for the newly spawn process.
However, QProcess::startDetached() is a static member function, so setProcessEnvironment() doesn't apply. How does one set Env variables for a detached process in Qt?
It is a known old bug: http://bugreports.qt-project.org/browse/QTBUG-2284. You need to overload startDetached
function to support your own environment. Take a look at Qt sources to see how to do that: http://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/io?h=5.5 (qprocess*
files).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With