Commit Graph

103 Commits

Author SHA1 Message Date
Joerg Bornemann
696a4bc2f9 Remove legacy from tst_qprocess.cpp
The windows.h include is not needed, the enums are properly known to
the metaobject system nowadays, and qprocess_p.h already has a
QT_NO_PROCESS guard.

Change-Id: I6bbdce19f097feb8260c51a29425279049aa0192
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-02-24 16:05:05 +00:00
Joerg Bornemann
479167cd4e tst_QProcess: Transform loop into additional test rows
Do not use a loop to execute similar but separate tests in
tst_QProcess::softExitInSlots. Use separate test rows with
distinguishable data tags instead.
This way we can deduce from CI output which part of this test failed.

Change-Id: Ic9bc996f2ced11b2bb1c33c1970e64937d860976
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-02-24 16:05:03 +00:00
Friedemann Kleint
adc4894fca tst_QProcess: Use a QTemporaryDir for files to be created.
Ensure the test works in a working directory with read-only
permission and that the file names are unique.
The test can then be executed repeatedly by COIN even in case
left-over hanging process helpers still lock the files. Also
disambiguate the "data" files used by various tests.

Task-number: QTBUG-47370
Change-Id: I3b9c7b70828da78f400196fcbba27bc61ea4538f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-11-26 15:53:34 +00:00
Friedemann Kleint
3c56e33a27 tst_QProcess: Remove macro QPROCESS_VERIFY().
It was used to verify waitForFinished() and printed QProcess::errorString()
on failure, which is misleading, since the process is not
in an error state - it is still running. Example:

QWARN  : tst_QProcess::setStandardOutputFileAndWaitForBytesWritten() QProcess error: 5: Unknown error
FAIL!  : tst_QProcess::setStandardOutputFileAndWaitForBytesWritten() 'ret' returned FALSE. ()

Use a plain QVERIFY instead.

Task-number: QTBUG-47370
Change-Id: Iacfa6e1a5ffd2be4e1257a27a400ccc59671e8c8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-11-25 20:50:18 +00:00
Friedemann Kleint
0ebebeb983 MSVC2015: Blacklist tests reading from stdin in buffered/text mode.
- tst_QProcess::fileWriterProcess()
- tst_QProcess::readLineStdin()
- [tst_QProcess::readLineStdin_lineByLine()

The test fails apparently due to a bug in its runtime library
(fread() dropping data).

Task-number: QTBUG-48455
Task-number: QTBUG-48504
Change-Id: I972e560e88312cea0d3dbcea9450c59285a15d5a
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2015-09-30 07:54:58 +00:00
Friedemann Kleint
a2995c180b tst_qprocess: Improve handling of helpers.
Verify exit status and code where applicable. Avoid unnecessary
data conversions in fileWriterProcess. Improve error handling in
helper processes.

Task-number: QTBUG-47370
Task-number: QTBUG-48455
Change-Id: Ib5c4f546027131db02caaa05154a5880edac5cf7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-09-30 04:29:56 +00:00
Friedemann Kleint
3cbb89fa5a tst_qprocess: Instantiate QProcess objects on the stack.
Instantiate the QProcess object on the stack to ensure resource
cleanup and remove the QProcess * member variable.
Use qobject_cast<QProcess *>(QObject::sender()) instead
of the member variable in the helpers slots to ensure that signals
from a leaked QProcess do not interfere with other tests.

Task-number: QTBUG-47370
Change-Id: Ifc0dccb7e4b18069d236df53bccdcb6a47df6346
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-09-25 20:22:17 +00:00
Friedemann Kleint
f322e2aa08 tst_qprocess: Port to Qt 5 connection syntax.
Task-number: QTBUG-47370
Change-Id: I09489a6fb4598238fa5e0120bf751fe5af6f31af
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-09-25 20:22:00 +00:00
Liang Qi
afab1546a7 Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
	qmake/doc/snippets/code/doc_src_qmake-manual.pro
	qmake/doc/src/qmake-manual.qdoc
	src/corelib/io/qstorageinfo_unix.cpp
	src/corelib/tools/qbytearray.cpp
	src/widgets/kernel/qwidgetwindow.cpp
	tests/auto/corelib/io/qprocess/tst_qprocess.cpp
	tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
	tests/auto/network/access/qnetworkreply/BLACKLIST

Change-Id: I9efcd7e1cce1c394eed425c43aa6fce7d2edf31c
2015-08-26 20:06:57 +02:00
Joerg Bornemann
a4bd096a0a remove pointless function separator comments from tst_qprocess
Newer test functions don't have those. Removing those comments makes
the code consistent.

Change-Id: I542b89e797ef061395ce1fc87d848195e6f81f35
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-08-26 09:38:53 +00:00
Joerg Bornemann
734557bb84 tst_qprocess cleanup
Give setStandardOutputFile2 a sensible name, move it to where it
belongs and remove bogus Q_OS_WINCE ifdef.

Change-Id: I5c843e8b6cb626979966f3e61f7a7c720173bb28
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-08-17 08:25:24 +00:00
Joerg Bornemann
507625d984 fix assertion in QProcess/Win
Do not call bytesAvailableInChannel if the source pipe end is
invalid. This is the case when redirecting channels on Windows.
The assertions in bytesAvailableInChannel were triggered whenever
an output process or output file was set and waitForBytesWritten
was called.

Task-number: QTBUG-45548
Change-Id: I225dfea2c5e27e122f75008a3a06d425554e00fe
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-08-17 08:25:19 +00:00
Alex Trotsenko
6dde874c32 QProcess: discard unwanted output from the child process
Drop process output to nullDevice(), if an application does not request
forwarding, redirecting or reading from the device channel. This
prevents from accumulation of unnecessary data which can not be read.

Change-Id: Ia311a8c658a46cf580ffa9484c5369f3fc5f98a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-08-16 14:22:32 +00:00
Thiago Macieira
1ff66a7962 QProcess: Ensure that the stdin buffer is cleared on start()
The buffer may have been left dirty if we were unable to write all the
data to the child process in the previous run. So ensure we clear it
before starting a new one. We already did that for stdout and stderr,
for some reason.

Task-number: QTBUG-44517
Change-Id: I1a800c709d3543699131ffff13c419da3bbffacf
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-08-15 21:59:26 +00:00
Frederik Gladhorn
77da617dc8 Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
	doc/global/qt-cpp-defines.qdocconf
	src/3rdparty/forkfd/forkfd.c
	src/corelib/codecs/qtextcodec.cpp
	src/corelib/kernel/qmetatype.cpp
	src/corelib/tools/qset.qdoc
	src/gui/accessible/qaccessible.cpp
	src/gui/image/qpixmapcache.cpp
	src/opengl/qgl.cpp
	src/tools/qdoc/generator.cpp
	src/widgets/kernel/qwidget.cpp
	tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp

Change-Id: I4fbe1fa756a54c6843aa75f4ef70a1069ba7b085
2015-08-06 10:54:01 +02:00
Joerg Bornemann
edb5f22b0a consistently handle empty program string in QProcess::start overloads
All overloads of QProcess::start will now check whether the program
string is empty and in that case
  - set error to FailedToStart,
  - set errorString to "No program defined",
  - emit error.

Until now only one of the three overloads behaved like this.

As a side effect, start(QString(), QStringList()) will not crash on
Windows anymore.

Task-number: QTBUG-47404
Change-Id: I2f93657204fe3643b1d74a74817843c05fc4a96b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
2015-07-30 05:33:28 +00:00
Thiago Macieira
db2fc7843c QProcess: make setWorkingDirectory stop launch if the dir doesn't exist
[ChangeLog][QtCore][QProcess] Fixed a bug that caused QProcess to launch
a child process on Unix even if the directory specified with
setWorkingDirectory did not exist.

Task-number: QTBUG-47271
Change-Id: Ib306f8f647014b399b87ffff13f195158b0e52f5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-07-20 16:07:46 +00:00
Kai Koehne
4672e319e6 Core: Replace QProcess::error signal with QProcess::errorOccurred
Make the name of the signal and the name of the getter unambiguous,
which in turn allows the easy use of Qt 5-style connects.

[ChangeLog][QtCore] Deprecated QProcess::error() signal in favor
of new QProcess::errorOccurred() one.

Change-Id: Ic5bcf7d6878e6985f1b4fed9dbe247527d13758c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-07-10 18:31:38 +00:00
Liang Qi
0aa2d318b1 Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
	src/corelib/global/qglobal.cpp
	src/corelib/global/qglobal.h
	src/corelib/global/qsysinfo.h
	src/corelib/global/qsystemdetection.h
	src/corelib/kernel/qobjectdefs.h
	src/plugins/plugins.pro
	tests/auto/widgets/itemviews/qlistview/qlistview.pro

Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
2015-07-01 11:05:26 +02:00
Nico Vertriest
a7f2af0911 Replace MAC OS X with OS X
Task-number: QTBUG-46374
Change-Id: I7bc633ab551740bd328a24b0ccae1d534af47138
Reviewed-by: Martin Smith <martin.smith@digia.com>
2015-06-30 07:33:31 +00:00
Simon Hausmann
f3939d943e Blacklist and skip various tests that are flakey
They didn't show up in the "old" CI runs because they usually pass the second
time they are executed - which the testrunner does. The new CI doesn't do that
anymore, instead we now mark those tests explicitly and will track their record
of passing and failing in the new metrics database.

Change-Id: Id34dd6f792f38995b07b6fec88f833df64de2f8b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-06-14 10:50:45 +00:00
Oswald Buddenhagen
d32f47b703 fix usage of wince scope
Fix style issues along the way.

Change-Id: Ic6a6de28e198eb0b14c198b802e78845703909b9
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-06-05 10:29:10 +00:00
Jani Heikkinen
83a5694dc2 Update copyright headers
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>
2015-02-11 06:49:51 +00:00
Rafael Roquetto
8ca735762d Fix tst_process on QNX when using spawn
QNX posix_spawn() implementation actually allows for detecting whether a
non-existent process has failed to start.

Change-Id: Ic1bf8da0d4636f1d7d9b7b4cf6ad45376f6df0ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-23 19:13:38 +01:00
Thiago Macieira
75a2c81b00 Handle posix_spawn using exit code 127 to indicate fail-to-start
Most posix_spawn implementations are done using fork(), so the only way
to report errors afer fork() is via a special exit code.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/posix_spawn.html
Change-Id: I3a37f81b0cb278bb31e5cb83c87e6b4c034dbc19
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-23 19:13:27 +01:00
Thiago Macieira
1814142b7a Use forkfd in QProcess
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>
2015-01-23 19:13:17 +01:00
Thiago Macieira
c8849dd8d5 Use waitid with WNOWAIT in forkfd
The previous implementation required one syscall per child we're waiting
on to see which one exited. That means the algorithm was O(n).

This implementation uses WNOWAIT to find out which child exited and then
goes straight to that one. So it's O(1) on the number of children, but
runs 2 * number_of_children_that_exited + 1 syscalls, assuming there are
no race conditions with other threads. If there are or if a child not
started by forkfd exits, we'll still iterate over each child we're
managing to see which one exited.

It modifies the existing code so that it will do a waitid() with WNOWAIT
to check on the status of the child: if the child has exited, we'll try
to lock the entry so only one thread will do the final wait(). In the
case we read the PID, then the child exited, was reaped by another
thread, the PID got recycled and that child exited again, we'll fail to
lock the ProcessInfo entry so no harm comes. If by an absurd coincidence
this other child was started by forkfd() and its ProcessInfo is exactly
the one we are looking at, then we'll succeed in locking but that's a
benign race: we'll do what the other thread was trying to do and the
other thread will give up.

Future improvements to the algorithm are discussed in the Gerrit change.

Change-Id: Ie74836dbc388cd9b3fa375a41a8d944602a32df1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-23 19:12:53 +01:00
Matti Paaso
974c210835 Update license headers and add new license files
- Renamed LICENSE.LGPL to LICENSE.LGPLv21
- Added LICENSE.LGPLv3
- Removed LICENSE.GPL

Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2
Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
2014-09-24 12:26:19 +02:00
Frederik Gladhorn
a09a8d509a Merge remote-tracking branch 'origin/5.3' into dev
Conflicts:
	mkspecs/qnx-x86-qcc/qplatformdefs.h
	src/corelib/global/qglobal.h
	src/network/socket/qnativesocketengine_winrt.cpp
	src/plugins/platforms/android/androidjniaccessibility.cpp
	src/plugins/platforms/windows/qwindowswindow.cpp

Manually adjusted:
	mkspecs/qnx-armle-v7-qcc/qplatformdefs.h
	to include 9ce697f2d5

Thanks goes to Sergio for the qnx mkspecs adjustments.

Change-Id: I53b1fd6bc5bc884e5ee2c2b84975f58171a1cb8e
2014-07-01 16:25:19 +02:00
Thiago Macieira
3ccfc351fd QProcess: Handle spurious socket notifications for stdout and stderr
On Unix systems where the GUI event dispatcher uses a notification
system for socket notifiers that is out of band compared to select(),
it's possible for the QSocketNotifier to activate after the pipe has
been read from. When that happened, the ioctl(2) call with FIONREAD
might return 0 bytes available, which we interpreted to mean EOF.

Instead of doing that, always try to read at least one byte and examine
the returned byte count from read(2). If it returns 0, that's a real
EOF; if it returns -1 EWOULDBLOCK, we simply ignore the situation.

That's the case on OS X: the Cocoa event dispatcher uses CFSocket to get
notifications and those use kevent (and, apparently, an auxiliary
thread) instead of an in-thread select() or poll(). That means the event
loop would activate the QSocketNotifier even though there is nothing to
be read.

Task-number: QTBUG-39488
Change-Id: I1a58b5b1db7a47034fb36a78a005ebff96290efb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-06-12 17:54:11 +02:00
Keith Gardner
43f52f93b5 Updated corelib's unit tests to use QSignalSpy's functor constructor
The intent is to provide compile time validation of signals and to help
detect signal overloading in the future.

Change-Id: I9d5d46ed4b70c5d0cd407deb5928b1e76d37e007
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
2014-05-08 04:22:54 +02:00
Sergio Ahumada
eab7efd1ee Stabilize tst_QProcess::softExitInSlots()
This test takes more than 5000ms to finish some times, so waiting
for 10000ms should be enough to make it more stable on all
platforms.

  ../tst_qprocess.cpp:1072 :: [gui app]
  QTestLib: This test case check ("proc.waitedForFinished") failed because the requested timeout (5000 ms) was too short, 6150 ms would have been sufficient this time.

Change-Id: I266ad0e65bf3c84e73b7ca6543dc15335dad4c99
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
2014-03-27 08:21:23 +01:00
Christian Strømme
2223cc8a2d Add function to get the actual PID from QProcess
It was not possible to get the actual process ID (in a cross-platform
manner) from QProcess, as the user would need to handle the returned
typedef (Q_PID) differently on Unix and Windows.

On Unix Q_PID is the actual process ID, but on Windows it's a pointer
to a PROCESS_INFORMATION structure, which among other fields contains
the process ID. Instead of returning a pointer on Windows,
QProcess::processId() will return the actual process ID on both Windows
and Unix.

[ChangeLog][QtCore][QProcess] Added processId() to QProcess. This
function will, unlike pid(), return the actual process identifier on
both Window and Unix.

Task-number: QTBUG-26136
Change-Id: I853ab721297e2dd9cda006666144179a9e25b73d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-14 00:34:25 +01:00
Kai Koehne
278152fffd Replace win32-g++ with mingw scope
Commit 773dd01 introduced a general mingw platform scope, which
is cleaner and more flexible than matching the spec name.

Change-Id: Ie3a9cb791a83f7c8a51bc4e23069190c452ab521
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-01-17 12:08:24 +01:00
Joerg Bornemann
7009843ae3 QProcess/Win: allow child processes to change modes of the stdin pipe
To be able to call SetNamedPipeHandleState on stdin in a child
process, we must create a read-end pipe handle with the
FILE_WRITE_ATTRIBUTES flag set.
This can't be done with CreateNamedPipe but only with CreateFile.
Therefore we're creating the handles for the child process always
with CreateFile now. Besides, it's conceptually cleaner to have the
server handle of the named pipe in the calling process.

[ChangeLog][QtCore][Windows] Fix regression from Qt4 in QProcess.
It wasn't possible anymore to alter pipe modes of stdin in child
processes.

Task-number: QTBUG-35357

Change-Id: I85f09753d0c924bdc8a6cef1ea5dbe6b2299c604
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-12-10 18:36:25 +01:00
Joerg Bornemann
29b0a565e9 fix Windows CE comments
Change-Id: Ib42c456c236f59727dddd6a111dfe0946fff1aef
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2013-12-09 11:57:53 +01:00
Oswald Buddenhagen
50a8a5e795 add QProcess::InputChannelMode
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>
2013-09-05 21:17:44 +02:00
Oswald Buddenhagen
fba0a30791 add QProcess::Forwarded{Output,Error}Channel
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>
2013-09-05 21:17:39 +02:00
Oswald Buddenhagen
40925fe74a fix warnings - qprocess needs a qcoreapp instance
Change-Id: Icf36c2e76595d8f2ed470da13e78c465cfa962f9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-09-05 11:18:59 +02:00
Oswald Buddenhagen
78d6c9c002 remove redundant forwardedChannels() test
forwardedChannelsOutput() actually tests forwarding. also having the
older test only eats CPU cycles.
rename the new test to the old name for clarity.

Change-Id: I16a326c8692bb594d7df7897bc53d31b23c66d90
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-09-05 11:18:59 +02:00
Oswald Buddenhagen
4028f54213 make error reporting in forwardedChannelsOutput test more useful
Change-Id: I0350ddfd6740d2a2cd3e0f49220cdaa83b854abf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-09-05 11:18:59 +02:00
Oswald Buddenhagen
60f8b2f4d0 micro-optimization/-clarification
close stdin and let the process finish right away instead of first
waiting for a reaction (which is not supposed to come) and then
finishing.

Change-Id: Ifcf200eead5ed95217843e105f9d2dbb5398d646
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-09-05 11:18:59 +02:00
Oswald Buddenhagen
a1133b215a add QProcess::nullDevice()
Change-Id: I15273fa3f3ba323a835350153f2a20404f12420b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-08-30 21:16:55 +02:00
Christian Strømme
c8d9b17367 Fix crash in QProcess::waitForStarted() on Unix.
Invoking waitForStarted() on a QProcess before or after an unsuccessful
call to start() (e.g., with an empty command), would execute FD_SET with
an invalid file descriptor and cause the process to abort.
The bug can be reliably reproduced on OSX.

Task-number: QTBUG-32958
Change-Id: Id25b7781168489281645e21571361ca1a71d43e3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-08-13 19:48:15 +02:00
Thiago Macieira
674e79416f Fix incomplete override of QIODevice::open in QProcess and QLocalSocket
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>
2013-07-20 00:22:03 +02:00
Joerg Bornemann
5cfac290ca remove wait calls in tst_QProcess::simpleStart
Instead of calling different wait functions on different platforms,
we use QTRY_COMPARE to check the process state.

Change-Id: I6489cabce9e63f9c8b1036f3cccbf35b52df72e7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
2013-07-02 16:33:08 +02:00
Joerg Bornemann
28ee554b37 QProcess/Win: drain output pipes on process finish
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>
2013-05-07 15:02:34 +02:00
Axel Waggershauser
b11317a643 Whitespace cleanup: remove trailing whitespace
Remove all trailing whitespace from the following list of files:
*.cpp *.h *.conf *.qdoc *.pro *.pri *.mm *.rc *.pl *.qps *.xpm *.txt *README
excluding 3rdparty, test-data and auto generated code.

Note A): the only non 3rdparty c++-files that still
have trailing whitespace after this change are:
* src/corelib/codecs/cp949codetbl_p.h
* src/corelib/codecs/qjpunicode.cpp
* src/corelib/codecs/qbig5codec.cpp
* src/corelib/xml/qxmlstream_p.h
* src/tools/qdoc/qmlparser/qqmljsgrammar.cpp
* src/tools/uic/ui4.cpp
* tests/auto/other/qtokenautomaton/tokenizers/*
* tests/benchmarks/corelib/tools/qstring/data.cpp
* util/lexgen/tokenizer.cpp

Note B): in about 30 files some overlapping 'leading tab' and
'TAB character in non-leading whitespace' issues have been fixed
to make the sanity bot happy. Plus some general ws-fixes here
and there as asked for during review.

Change-Id: Ia713113c34d82442d6ce4d93d8b1cf545075d11d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-03-16 20:22:50 +01:00
Corentin Jabot
866a5d0c28 Make QProcess startable with open()
Add setProgram() and setArguments() methods to the QProcess api.
Add a convenient start(QIODevice::OpenMode) method.
Move the implementation of QProcess::start() to QProcess::open()
unifying the QProcess api with other QIODevice subclasses.

Change-Id: Id1af57da05f750fe8d526d391589c05ee8037bca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-03-05 18:39:35 +01:00
Frederik Gladhorn
e65cd6f379 Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
	src/concurrent/doc/qtconcurrent.qdocconf
	src/corelib/doc/qtcore.qdocconf
	src/corelib/global/qglobal.h
	src/dbus/doc/qtdbus.qdocconf
	src/dbus/qdbusmessage.h
	src/gui/doc/qtgui.qdocconf
	src/gui/image/qimagereader.cpp
	src/network/doc/qtnetwork.qdocconf
	src/opengl/doc/qtopengl.qdocconf
	src/opengl/qgl.h
	src/plugins/platforms/windows/qwindowswindow.cpp
	src/printsupport/doc/qtprintsupport.qdocconf
	src/sql/doc/qtsql.qdocconf
	src/testlib/doc/qttestlib.qdocconf
	src/tools/qdoc/doc/config/qt-cpp-ignore.qdocconf
	src/widgets/doc/qtwidgets.qdocconf
	src/xml/doc/qtxml.qdocconf

Change-Id: Ie9a1fa2cc44bec22a0b942e817a1095ca3414629
2013-02-14 14:24:57 +01:00