summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Use QMap in QProcessEnvironment so variables are sortedThomas Sondergaard2017-06-131-19/+16
| | | | | | | | | | | | | | | | | | | | | | The motivation for this change is to make it simple to pass a correctly sorted environment block to Win32 CreateProcess(). It is also nice in other contexts that the environment variables are sorted. The change is made for all platforms. This keeps it simple and the only ill effect is slightly slower lookups. Concerning the environment block passed to Win32 CreateProcess: The environment block that is passed to CreateProcess() must be sorted case-insensitively and without regard to locale. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682009(v=vs.85).aspx The need for sorting the environment block is also mentioned in the CreateProcess() documentation, but with less details: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx Task-number: QTBUG-61315 Change-Id: Ie1edd443301de79cf5f699d45beab01b7c0f9de3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rename QProcessEnvironmentPrivate::hash to varsThomas Sondergaard2017-06-131-3/+3
| | | | | | | | | Also use auto for iterators to vars. This is a small refactoring in preparation for changing type of vars to QMap. Task-number: QTBUG-61315 Change-Id: I5731d7916b6f54a0da5be2da378c09a7688bd870 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-03-131-5/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/network/network.pro mkspecs/features/mac/default_post.prf src/corelib/io/qfilesystemengine_win.cpp src/corelib/io/qprocess.cpp src/corelib/io/qprocess.h src/corelib/io/qprocess_p.h src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/corelib/thread/qmutex.cpp src/platformsupport/fontdatabases/windows/windows.pri src/plugins/platforms/eglfs/eglfsdeviceintegration.pro tests/auto/corelib/io/io.pro Change-Id: I8a27e0e141454818bba9c433200a4e84a88d147e
| * Properly use the "process" featureUlf Hermann2017-02-271-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | Replace all QT_NO_PROCESS with QT_CONFIG(process), define it in qconfig-bootstrapped.h, add QT_REQUIRE_CONFIG(process) to the qprocess headers, exclude the sources from compilation when switched off, guard header inclusions in places where compilation without QProcess seems supported, drop some unused includes, and fix some tests that were apparently designed to work with QT_NO_PROCESS but failed to. Change-Id: Ieceea2504dea6fdf43b81c7c6b65c547b01b9714 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Introduce a configure option for QProcessEnvironmentJake Petroules2016-12-161-4/+8
|/ | | | | | | | This decouples QProcess and QProcessEnvironment, since the latter may actually be available on platforms where the former is not. Change-Id: I3dc799ffdf94486b64143ed01a369897fff44a96 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-061-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/qtestlib/tutorial5/containers.cpp examples/widgets/tools/tools.pro src/corelib/io/qprocess.cpp src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/network/kernel/qdnslookup_unix.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp tools/configure/configureapp.cpp Change-Id: I838ae7f082535a67a4a53aa13a21ba5580758be8
| * QWindowsPipeWriter: ensure validity of the write bufferAlex Trotsenko2016-04-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QWindowsPipeWriter uses asynchronous API to perform writing. Once a cycle has been started, the write buffer must remain valid until the write operation is completed. To avoid data corruption and possibly undefined behavior, this patch makes QWindowsPipeWriter::write() take a QByteArray, which it keeps alive for the duration of the write cycle. Autotest-by: Thomas Hartmann Task-number: QTBUG-52401 Change-Id: Ia35faee735c4e684267daa1f6bd689512b670cd2 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Simon Hausmann2016-03-231-6/+1
|\| | | | | | | Change-Id: I9a10e1f3c9506ec8554d8f59b6300825ac730939
| * Remove QPROCESS_USE_SPAWN and all that it surroundsJames McDonnell2016-03-221-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The spawn code was only used to make QProcess work on QNX 6.5.0. Fork works on QNX 6.6.0. The QNX spawn implementation has a flaw that causes a deadlock in certain situations. When a working directory is specified for the process, the QNX spawn implementation stops all threads except the one doing the spawn so that it can temporarily change the process' working directory. This can lead to a deadlock if the thread does anything that conficts with something being done in a stopped thread. QNX 6.5.0 is no longer supported in Qt 5.6.0 so we can just switch QNX to the fork implementation and get rid of the spawn implementation. Made a QNX specific adjustment to the hardExit test. There's a bug in the OS that the test can run into because it does something that normal applications wouldn't. Task-number: QTBUG-47250 Change-Id: Ib32567d2c15ce651815858000035ac5aa6f35224 Reviewed-by: Dan Cape <dcape@qnx.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* | QProcess: Remove dead codeLouai Al-Khanji2016-02-051-1/+0
| | | | | | | | | | | | | | | | These functions appear to have been dead code always - even in the earliest Qt4 releases! Change-Id: Ie2a458092b45113782284cf8ed3aa11a018b60d4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Integrate QProcess into QIODevice's multistreaming infrastructureAlex Trotsenko2016-01-291-3/+0
| | | | | | | | | | | | | | | | As a result, this patch eliminates double-buffering in QProcess. Change-Id: I436faa4a5ffc28ce77f959dd6089bef400ac39f6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | | | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | add a way to modify CreateProcess parametersJoerg Bornemann2015-12-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QProcess] Added method setCreateProcessArgumentsModifier to QProcess on Windows to enable users to intercept and modify CreateProcess parameters. With such a modifier, calling code can decide whether to inherit handles, modify the STARTUPINFO struct, and pass its own combination of process flags to CreateProcess. Task-number: QTBUG-390 Task-number: QTBUG-6917 Task-number: QTBUG-9350 Task-number: QTBUG-24619 Change-Id: I14757dbbacfebb1c89f52402d36fba0ba9c45f3a Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Remove remaining support for BlackberryLouai Al-Khanji2015-11-211-5/+0
|/ | | | | | | | | The platform is no longer supported or actively maintained, and is in the way for improvements to the Unix event dispatcher and QProcess implementations. Change-Id: I3935488ca12e2139ea5f46068d7665a453e20526 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Do not overwrite detailed error message if process fails to launchKai Koehne2015-11-121-1/+1
| | | | | | | | | | | | | On Unix we get a detailed error message when a process fails to start, but later on we overwrite it with a generic "Process fails to start". Fix this by keeping the original error message (if one is available). This fixes a regression introduced in commit 5147f73ac3. Task-number: QTBUG-49286 Change-Id: Idd0f0fed9773d39f2947fc3e532b51e670952caf Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Core: Consolidate QProcess error reportingKai Koehne2015-06-201-0/+2
| | | | | | | | | Introduce two methods to set set error and errorString, and optionally emit the error() signal. This also fixes two places where errorString hasn't been set previously. Change-Id: Ib7c27ff2daff898745e8e20ff8f11eaae568697f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* remove the "wonderful Windows notifier" from QProcessJoerg Bornemann2015-04-131-3/+1
| | | | | | | | | | | | | Remove the 100 ms timer that was used to nudge QProcess to write data to the child's stdin. Instead, react on the canWrite() signal of QWindowsPipeWriter. QProcess::writeData needs to call _q_canWrite via the event loop to start the write operation. The socket notifier code was never in use on Windows. Task-number: QTBUG-45457 Change-Id: I99c956ba5f2169f80068eee206543ceb9788b2e0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Use forkfd in QProcessThiago Macieira2015-01-231-10/+8
| | | | | | | | | | | | | | | | | | | | Replace the existing code in QProcess that dealt with signaling of child processes exiting with forkfd and spawnfd. The previous code was convoluted and hard to maintain, having shown its age in the last year. I've been running it for a year and a half and the new implementation is definitely an improvement. This change replaces support for the QNX Neutrino spawn() call with the POSIX version. We lose the ability to do setsid(), but we gain quite a few ioctls() that were done to fill in the file descriptor mapping structure. That's also the only OS for which we have the ability to thread-safely chdir() before the call to spawnfd(). Another advantage is that forkfd does not require a dedicated thread running to handle child processes exiting. Change-Id: I5eb76821dfdb6a8ed2989d7f53b3c31e515c3174 Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* QtCore: mark some operations nothrowMarc Mutz2015-01-101-1/+1
| | | | | | | | | | | | This shotgun-surgery approach is motivated by trying to get a clean(er) build for -Wnoexcept on GCC, so it is expected that for any class touched here, there will be more operations that can be marked nothrow. But they don't show up in conditional noexcept clauses, yet, so they are deferred to some later commit. Change-Id: I0eb10d75a26c361fb22cf785399e83b434bdf233 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QProcessPrivate: merge the functions dealing with stdout and stderrThiago Macieira2014-06-121-4/+3
| | | | | | | Simplifies the code. Change-Id: I4b3a6e725eb245d3531d1d11d959fb3b85862778 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Rename QProcessPrivate::destroyChannel to closeChannelThiago Macieira2014-06-121-2/+2
| | | | | | | | | | | The QProcessPrivate::Channel object contains some structures that may survive the closing of the pipe, so calling this function "destroy" is incorrect. Let it be just the closing. For symmetry, the createChannel() function is renamed to openChannel(). Change-Id: I2899214c6e4c25835390b10ccf3931315a91589e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Move the QProcessPrivate Windows objects into QProcessPrivate::ChannelThiago Macieira2014-06-121-3/+9
| | | | | | | Similar to the previous commit, this simplifies the code. Change-Id: Ia02b9b5174b4bc6fd04ec2534231b7db5fc914fa Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Move the QProcessPrivate channel buffers into QProcessPrivate::ChannelThiago Macieira2014-06-121-4/+1
| | | | | | | Simplifies the code. Change-Id: I70b26af69332f364d856042f114c37a70504d66f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* BB select(): move special select method to qcore_unix_p.hPeter Hartmann2014-03-141-0/+5
| | | | | | | | | | | | | | ... and make it independent of QProcess, because we want to use it from QtNetwork as well. In addition, move select_msecs() to qcore_unix_p.h as well and rename it to qt_select_msecs(). Task-number: QTBUG-36144 Change-Id: Ief681b6f6c80e85aa5091a5a04bcedb60f353217 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* add QProcess::InputChannelModeOswald Buddenhagen2013-09-051-0/+1
| | | | | | | | | | | this enables forwarding standard input from the parent process. Change-Id: I7ee72b9842acc96320d4da693b95dd15d9a7b4d4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* Fix incomplete override of QIODevice::open in QProcess and QLocalSocketThiago Macieira2013-07-201-0/+1
| | | | | | | | | | | | | | | | | | | The rule for a new override is that it must still work if the old implementation is called. The catch is that any class that derives from QProcess and isn't recompiled will still have QIODevice::open in its virtual table. That is equivalent to overriding open() and calling QIODevice::open() (like the tests). In Qt 5.0, QProcess::start() called QIODevice::open directly, not the virtual open(), so there's no expectation that a user-overridden open() be called. With that in mind, simply fix QProcess::start to not call the virtual open at all. Similarly with QLocalSocket, the calls to open were always non-virtual. Task-number: QTBUG-32284 Change-Id: I88925f0ba08bc23c849658b54582744997e69a4c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* restore QProcessEnvironment shared data thread safety on unixOswald Buddenhagen2013-05-201-0/+43
| | | | | | | | | | | | | | | | | implicit sharing together with 'mutable' is a time bomb. we need to protect the nameMap, because concurrent "reads" may try to insert into the hash, which would go boom. we need to protect the key/value of Hash objects, because while the refcounting is atomic, the d pointer assignments are not, which would also go boom. we can simply use a QMutex to protect the whole environment, because it is very cheap in the uncontended case. Task-number: QTBUG-30779 Change-Id: Iaad5720041ca06691d75eb9c6c0e1c120d4a7b46 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QProcess/Win: drain output pipes on process finishJoerg Bornemann2013-05-071-0/+1
| | | | | | | | | | | | If a process dies before all output is read into the internal buffer of QProcess, we might lose data. Therefore we must drain the output pipes like we already do in the synchronous wait functions. Task-number: QTBUG-30843 Change-Id: I8bbc5265275c9ebd33218ba600267ae87d93ed61 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Enables QProcess back on QNX.Rafael Roquetto2012-02-171-1/+3
| | | | | | | | | | Because fork()/vfork() on QNX are not supported on multithreaded applications, QProcess had been disabled on this platform. The corresponding code has now been replaced with functions that wrap around spawn(). Change-Id: I46091b7d41f322a5cad07d17893aa929c84941ef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove Symbian specific code from QtCore.Xizhi Zhu2012-01-301-10/+2
| | | | | Change-Id: I131303e28a12dccb96de3de4ca0073b389a9bbae Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* QProcess/Win: use asynchronous I/O for reading stdout and stderrJoerg Bornemann2012-01-261-0/+6
| | | | | | | | This saves us from using the 100 ms polling timer to read process output. Task-number: QTBUG-23012 Change-Id: I3f9398d7a4d30826d2d89ac04bd2fd031500ff57 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Replace implicit QAtomic* casts with explicit load()/store()Bradley T. Hughes2011-10-271-1/+1
| | | | | Change-Id: Ia7ef1a8e01001f203e409c710c977d6f4686342e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* don't crash in QProcessEnvironment::systemEnvironment()Oswald Buddenhagen2011-05-101-0/+12
| | | | | | | | | as the implementations moved to platform-specific files, the QSharedDataPointer<QProcessEnvironmentPrivate>::detach() specialization needs to go to the private header. Reviewed-by: thiago (cherry picked from commit c79246683a5033f605acd59d1c37d68381383a06)
* fix build on symbianOswald Buddenhagen2011-05-101-62/+60
| | | | | | | | | Error: #793: explicit specialization of class "QTypeInfo<QProcessEnvironmentPrivate::Key>" must precede its first use just un-nest QProcessEnvironmentPrivate::{Key,Value} Reviewed-by: thiago (cherry picked from commit 167044693cc1d16684a5732b05e3926d0af61960)
* make QProcessEnvironment on Unix cache converted valuesOswald Buddenhagen2011-05-101-3/+34
| | | | | | | | | | values are converted between byte arrays and qstrings on demand. this makes it feasible to use the class as a generic environment container with fast reading and writing access. Reviewed-by: thiago Reviewed-by: dt (cherry picked from commit 7aa4ecdedba60ac4cbc07a774ae9d834677002e9)
* make QProcessEnvironment on Unix cache converted variable namesOswald Buddenhagen2011-05-101-5/+35
| | | | | | | | | the converted keys also cache their hash, as they are used only for the purpose of looking up in a qhash. Reviewed-by: thiago Reviewed-by: dt (cherry picked from commit 18f1613aa8ece72d24ac10e28f06e3db1d8ce400)
* move key/value converters to the private classOswald Buddenhagen2011-05-101-0/+10
| | | | | | | | this will enable them to access other members later Reviewed-by: thiago Reviewed-by: dt (cherry picked from commit a2d70d71c8c7652ded41d5d603672c3927df44e6)
* make QProcessEnvironment on Windows preserve variable name caseOswald Buddenhagen2011-05-101-1/+13
| | | | | | | | | | | | | | | | while windows itself does not care which case the variable names are in, they may be passed to unix tools which *do* care. note that this uses true case folding for string comparisons while windows uses uppercasing. this means that "ess" and "eß" will be considered the same by us, while not by windows. this is not expected to have real-world impact, particularly because non-ascii variable names are not used much. Task-number: QTCREATORBUG-3110 Reviewed-by: thiago Reviewed-by: dt (cherry picked from commit f3db5603871928ebed43a085a496397e65952b39)
* split QProcessEnvironmentPrivate::Unit into Key and ValueOswald Buddenhagen2011-05-101-3/+6
| | | | | | Reviewed-by: thiago Reviewed-by: dt (cherry picked from commit 11a79c65ea992be0e2ede7dc8f60660c9190291f)
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+260
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12