summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess_win.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QProcess/Win: fix crash in drainOutputPipesJoerg Bornemann2013-10-021-2/+2
| | | | | | | | | | | | | stdoutReader->waitForReadyRead() can synchronously trigger the deletion of stdoutreader (via signal readyRead(), _q_canReadStandardOutput(), destroyChannel()). Analoguous for stderrReader. Task-number: QTBUG-33730 Change-Id: I8badac53e92a979c437838b2959b4c0445c8de81 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* add QProcess::InputChannelModeOswald Buddenhagen2013-09-051-1/+9
| | | | | | | | | | | 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>
* add QProcess::Forwarded{Output,Error}ChannelOswald Buddenhagen2013-09-051-2/+4
| | | | | | | Change-Id: Ifc5ed20c38f3228ef25c28681f296d0456b61abe Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* make the pipe setup code less convolutedOswald Buddenhagen2013-09-051-16/+21
| | | | | | | Change-Id: Ied870c892cc3dbbf24a3d9416f685e51a74e5c17 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
* never create a console for command line tools launched from gui appsOswald Buddenhagen2013-09-051-3/+6
| | | | | | | | | | | | | | | commit 219b0d217 fixed forwarding of stdio to a console. unfortunately, it also forced the creation of a console in the first place if there was none, which is not part of the contract. instead, give the child process a window (== console) only we we already have one. this can be done irrespective of our channel mode, which has the nice side effect that an explicit redirection to a console would now also work. Change-Id: Id25cab5da1ac1cc8ce452127ff95bac8d0a0fea8 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
* remove redundant conditionOswald Buddenhagen2013-09-051-3/+2
| | | | | | | ForwardedChannels implies that both stdoutReader and stderrReader are null. Change-Id: I9d5f02d3a1eac62316a6016b90c612d716ecaafc Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* fix endless loop in QProcess/Win drainOutputPipesJoerg Bornemann2013-07-181-2/+4
| | | | | | | | | | | Commit 568f82fba397e06a26b4fd40f074e4432d02d248 was incomplete. If drainOutputPipes detected some readyRead it wouldn't end the loop. Task-number: QTBUG-32354 Change-Id: I4e594f1e148abe9ef36c047a55eee1b22fd5064b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* fix infinite loop in QProcessPrivate::drainOutputPipesJoerg Bornemann2013-07-051-1/+1
| | | | | | | | | | | | | | | | | | When drainOutputPipes is called, the process is already dead. If readyReadEmitted is false, there was no data in the pipes. As the process is dead, there won't be data in the pipes in future iterations. The situation that triggered the infinite loop was this: process A starts console process B. B starts console process C. C inherits stdout/err of B. B dies. C runs forever and does not close the stdout/err handles. A notices that B died and calls drainOutputPipes. Task-number: QTBUG-29391 Change-Id: I4819901df307be684c6ad70753a5f964a834704a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* QProcess/Win: drain output pipes on process finishJoerg Bornemann2013-05-071-11/+11
| | | | | | | | | | | | 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>
* QThread: fix race when setting the eventDispatcherDavid Faure2013-03-221-1/+1
| | | | | | | Use QAtomicPointer to make this thread-safe. Change-Id: If71f204699fcefabdb59bd26342d777d1cc9e2a7 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QProcess/Win: stop pipe readers before closing the pipe handlesJoerg Bornemann2013-03-141-0/+2
| | | | | | | | The pipe readers should not operate on closed handles. Change-Id: I6514b949e5ab2adf89633463fc599e8d02c43693 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* QProcess/Win: do not treat all negative exit codes as crashJoerg Bornemann2013-03-131-2/+2
| | | | | | | | | | | | Only exit codes that are likely to be in the range of EXCEPTION_* and STATUS_* codes are treated as crash. Task-number: QTBUG-28735 Change-Id: I36ae6dc4be28df0c6b6b7361df2c2d0203ee7919 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QProcessEnvironment: Permit magic cmd variablesDaniel Teske2013-02-081-1/+2
| | | | | | | | | The cmd shell inserts magic variables starting with a = into the environment. Task-number: QTCREATORBUG-8716 Change-Id: I2f140032aea4fb1d77633c6baf90d7b536e2812a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@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>
* Fix compilation with (all versions of) MinGWKai Koehne2012-12-111-1/+1
| | | | | | | | | | | | | | | | Commit 320b16110f0f9cef032a64846dc792d40ccd367b changed the arguments of swprintf to be compliant with latest MinGW-w64 headers: The headers now excludes the non-standard swprintf(wchar*t,wchar_t*,...) version for C++11. However, the swprintf(wchar_t*,size_t,wchar_t*,...) version is actually not supported by e.g. stock Mingw-32 from mingw.org. Instead, use _snwprintf(wchar_t*,size_t,wchar_t*,...), which both MSVC, and all MinGW versions should support. Task-number: QTBUG-28520 Change-Id: Icadd11773a25143e46a72c898adfd1c324f9c468 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* QProcess: Fix compilation with MinGWKai Koehne2012-12-061-1/+2
| | | | | | | | newer mingw-w64 headers do not support swprintf(wchar_t*,wchar_t*, ..) any more. Change-Id: I2fc1fb51ba8d5237149697f77a91abd6469ebb09 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Trim trailing whitespace.Stephen Kelly2012-10-221-2/+2
| | | | | Change-Id: Iee6bb66831f53399e5937eab5704af835979f5c3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QProcess/Win fix forwarding of output channelsJoerg Bornemann2012-09-281-16/+20
| | | | | | | | | | We must not create pipe readers for the forwarded channels as we don't want to read from stdout/stderr into the internal QProcess buffer. Also, we must not pass CREATE_NO_WINDOW to CreateProcess because this will render our stdout/stderr handles useless. Change-Id: Ie6485e86c103d1e9225cf39c04aa54093c1efe0d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@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>
* Revert "Use true and false in preference to TRUE and FALSE"Sergio Ahumada2012-09-071-8/+8
| | | | | | | | | | | Even though I really think the change was the right thing to do, it seems like Windows people don't like this change because of some Windows Data Types specific rules. This reverts parts of the commit 56d5c909af6473be64a1ae487b45bd444a9a8553. Change-Id: I2c67d9b1bab36fc63937ef386aef56d2a4472a04 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Use true and false in preference to TRUE and FALSESergio Ahumada2012-09-051-8/+8
| | | | | | | | The TRUE and FALSE macros are obsolete and should be replaced with true and false (all lower case) respectively. Change-Id: Iee352e8173500683e6319be0abbf5bacf29016e0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* get rid of "uninitialized member" gcc warningKonstantin Ritt2012-06-071-2/+1
| | | | | Change-Id: I486212829ec9309239645222e7f03f36ae4847f0 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* QProcess/Win: pointless Sleep call removedJoerg Bornemann2012-03-061-2/+0
| | | | | | Change-Id: I634c62d3a0f96bc074e815dfd4106b6187f4ba85 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* fix QProcess for Windows XPJoerg Bornemann2012-02-201-1/+4
| | | | | | | | | | | | CreateNamedPipe supports the flag PIPE_REJECT_REMOTE_CLIENTS since Windows Vista. On earlier Windows versions the system call would fail with ERROR_INVALID_PARAMETER. This does not open a security hole on Windows XP as there can be only one pipe instance. Change-Id: I5a1c7fdf756678009857317c7b563c884afeef2c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* MinGW: Fix warnings.Friedemann Kleint2012-02-041-2/+2
| | | | | | | | - Special #define to access HB seems no longer necessary (it was causing about mismatching DLL import attributes). Change-Id: I57cc7d57b12a67c1d549b053db81e1f198f87786 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* MinGW build fixes for QWindowsPipeReader and friendsJoerg Bornemann2012-01-311-1/+4
| | | | | Change-Id: Ie4d6017c6fb918e7796d1a5e8863e9368e4e1894 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@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-50/+88
| | | | | | | | 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>
* QProcess/Win: use named pipes for redirecting standard I/OJoerg Bornemann2012-01-261-21/+51
| | | | | | | | Named pipes allow us to make use of overlapped I/O for redirected stdin, stdout and stderr. Change-Id: I50191b036bce696147139b200ddbc6c31c16112b 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>
* QProcess/Win: direct forwarding of stdout and stderrJoerg Bornemann2012-01-081-26/+14
| | | | | | | | | | | | | We are now directly passing the standard out/err handles to CreateProcess instead of reading the output and writing it. The downside is, that we cannot automatically forward the process output of GUI applications anymore. This behaviour is intended by the CreateProcess API. Change-Id: Ic6e35c8c338dbea1a9f345567a37d938da1f34a2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* split qprocess_win.cpp into Windows and WinCE partsJoerg Bornemann2012-01-061-74/+9
| | | | | Change-Id: I7f2cf2c42dd24ca162238e6dc6408ac39dfcd790 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@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>
* Make QWinEventNotifier part of the public APIDebao Zhang2011-12-011-1/+1
| | | | | | | | | | | | QWinEventNotifier is an essential class if you're using native Windows Overlapped IO and need to convert it to Qt signals. However the header is marked private. Task-number: QTBUG-68 Change-Id: I22e9a84da97f969ddb82e9ba15e604a01abd80d0 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* QtCore/IO: Fix some warnings on Windows (64bit).Friedemann Kleint2011-11-291-1/+1
| | | | | | | | - Warnings about conversion from size_t to int - Unused variable. Change-Id: I4a79fa6dc4b95551a64d282ae4307b0edff41201 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* make argument quoting code on windows less arcaneOswald Buddenhagen2011-07-041-7/+4
| | | | | | | Change-Id: I6eca1d336ff770d3e5548e58137ca0053d4f63db Reviewed-on: http://codereview.qt.nokia.com/963 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* fix argument quoting on windowsOswald Buddenhagen2011-07-041-4/+3
| | | | | | | | | | quotes prefixed with multiple backslashes would not be escaped correctly. Change-Id: I56ec72e31bb4ed2b9119ec1996448f803f89ce35 Reviewed-on: http://codereview.qt.nokia.com/962 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.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
* no environment on WinCEOswald Buddenhagen2011-05-101-0/+4
| | | | (cherry picked from commit 62e73a463cb7035192acdce6538c5b0248e643d4)
* fix Widestring vs. Ansi mixupOswald Buddenhagen2011-05-101-1/+1
| | | | (cherry picked from commit 4dcb4a41022085aa82f25f7e0a2ce9e92510f4ae)
* fix potential crash in QProcessEnvironment::systemEnvironment() on windowsOswald Buddenhagen2011-05-101-10/+11
| | | | | GetEnvironmentStrings() can theoretically return null (cherry picked from commit 443608952d7df9a5146317be992320ba232d2cf9)
* make QProcessEnvironment::systemEnvironment() encoding-safeOswald Buddenhagen2011-05-101-0/+20
| | | | | | | | | | | on unix, don't do the roundtrip over unicode. on windows, use the WinAPI unicode environment instead of the 8-bit CRT environment. Reviewed-by: thiago Reviewed-by: dt (cherry picked from commit 60194ad0ea68d7c82b4729119d122dcfeb909842)
* make QProcessEnvironment on Windows preserve variable name caseOswald Buddenhagen2011-05-101-5/+7
| | | | | | | | | | | | | | | | 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)
* use the Hash typedefOswald Buddenhagen2011-05-101-4/+4
| | | | | | Reviewed-by: thiago Reviewed-by: dt (cherry picked from commit 10fd0d3e5c88c7b0265db3acdd75cb3d6f35ee63)
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+855
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