qprocess.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qprocess.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Copyright (C) 2016 Intel Corporation.-
5** Contact: https://www.qt.io/licensing/-
6**-
7** This file is part of the QtCore module of the Qt Toolkit.-
8**-
9** $QT_BEGIN_LICENSE:LGPL$-
10** Commercial License Usage-
11** Licensees holding valid commercial Qt licenses may use this file in-
12** accordance with the commercial license agreement provided with the-
13** Software or, alternatively, in accordance with the terms contained in-
14** a written agreement between you and The Qt Company. For licensing terms-
15** and conditions see https://www.qt.io/terms-conditions. For further-
16** information use the contact form at https://www.qt.io/contact-us.-
17**-
18** GNU Lesser General Public License Usage-
19** Alternatively, this file may be used under the terms of the GNU Lesser-
20** General Public License version 3 as published by the Free Software-
21** Foundation and appearing in the file LICENSE.LGPL3 included in the-
22** packaging of this file. Please review the following information to-
23** ensure the GNU Lesser General Public License version 3 requirements-
24** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
25**-
26** GNU General Public License Usage-
27** Alternatively, this file may be used under the terms of the GNU-
28** General Public License version 2.0 or (at your option) the GNU General-
29** Public license version 3 or any later version approved by the KDE Free-
30** Qt Foundation. The licenses are as published by the Free Software-
31** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
32** included in the packaging of this file. Please review the following-
33** information to ensure the GNU General Public License requirements will-
34** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
35** https://www.gnu.org/licenses/gpl-3.0.html.-
36**-
37** $QT_END_LICENSE$-
38**-
39****************************************************************************/-
40-
41//#define QPROCESS_DEBUG-
42-
43#include <qdebug.h>-
44#include <qdir.h>-
45#if defined(Q_OS_WIN)-
46#include <qtimer.h>-
47#endif-
48#if defined QPROCESS_DEBUG-
49#include <qstring.h>-
50#include <ctype.h>-
51#if !defined(Q_OS_WINCE)-
52#include <errno.h>-
53#endif-
54-
55QT_BEGIN_NAMESPACE-
56/*-
57 Returns a human readable representation of the first \a len-
58 characters in \a data.-
59*/-
60static QByteArray qt_prettyDebug(const char *data, int len, int maxSize)-
61{-
62 if (!data) return "(null)";-
63 QByteArray out;-
64 for (int i = 0; i < len && i < maxSize; ++i) {-
65 char c = data[i];-
66 if (isprint(c)) {-
67 out += c;-
68 } else switch (c) {-
69 case '\n': out += "\\n"; break;-
70 case '\r': out += "\\r"; break;-
71 case '\t': out += "\\t"; break;-
72 default:-
73 char buf[5];-
74 qsnprintf(buf, sizeof(buf), "\\%3o", c);-
75 buf[4] = '\0';-
76 out += QByteArray(buf);-
77 }-
78 }-
79-
80 if (len < maxSize)-
81 out += "...";-
82-
83 return out;-
84}-
85-
86QT_END_NAMESPACE-
87-
88#endif-
89-
90#include "qprocess.h"-
91#include "qprocess_p.h"-
92-
93#include <qbytearray.h>-
94#include <qelapsedtimer.h>-
95#include <qcoreapplication.h>-
96#include <qsocketnotifier.h>-
97#include <qtimer.h>-
98-
99#ifdef Q_OS_WIN-
100#include <qwineventnotifier.h>-
101#else-
102#include <private/qcore_unix_p.h>-
103#endif-
104-
105#ifndef QT_NO_PROCESS-
106-
107QT_BEGIN_NAMESPACE-
108-
109/*!-
110 \since 5.6-
111-
112 \macro QT_NO_PROCESS_COMBINED_ARGUMENT_START-
113 \relates QProcess-
114-
115 Disables the-
116 \l {QProcess::start(const QString &, OpenMode)}{QProcess::start()}-
117 overload taking a single string.-
118 In most cases where it is used, the user intends for the first argument-
119 to be treated atomically as per the other overload.-
120-
121 \sa QProcess::start(const QString &command, OpenMode mode)-
122*/-
123-
124/*!-
125 \class QProcessEnvironment-
126 \inmodule QtCore-
127-
128 \brief The QProcessEnvironment class holds the environment variables that-
129 can be passed to a program.-
130-
131 \ingroup io-
132 \ingroup misc-
133 \ingroup shared-
134 \reentrant-
135 \since 4.6-
136-
137 A process's environment is composed of a set of key=value pairs known as-
138 environment variables. The QProcessEnvironment class wraps that concept-
139 and allows easy manipulation of those variables. It's meant to be used-
140 along with QProcess, to set the environment for child processes. It-
141 cannot be used to change the current process's environment.-
142-
143 The environment of the calling process can be obtained using-
144 QProcessEnvironment::systemEnvironment().-
145-
146 On Unix systems, the variable names are case-sensitive. Note that the-
147 Unix environment allows both variable names and contents to contain arbitrary-
148 binary data (except for the NUL character). QProcessEnvironment will preserve-
149 such variables, but does not support manipulating variables whose names or-
150 values cannot be encoded by the current locale settings (see-
151 QTextCodec::codecForLocale).-
152-
153 On Windows, the variable names are case-insensitive, but case-preserving.-
154 QProcessEnvironment behaves accordingly.-
155-
156 \sa QProcess, QProcess::systemEnvironment(), QProcess::setProcessEnvironment()-
157*/-
158-
159QStringList QProcessEnvironmentPrivate::toList() const-
160{-
161 QStringList result;-
162 result.reserve(hash.size());-
163 for (Hash::const_iterator it = hash.cbegin(), end = hash.cend(); it != end; ++it)
it != endDescription
TRUEevaluated 16172 times by 2 tests
Evaluated by:
  • tst_QProcessEnvironment
  • tst_Selftests
FALSEevaluated 2290 times by 2 tests
Evaluated by:
  • tst_QProcessEnvironment
  • tst_Selftests
2290-16172
164 result << nameToString(it.key()) + QLatin1Char('=') + valueToString(it.value());
executed 16172 times by 2 tests: result << nameToString(it.key()) + QLatin1Char('=') + valueToString(it.value());
Executed by:
  • tst_QProcessEnvironment
  • tst_Selftests
16172
165 return result;
executed 2290 times by 2 tests: return result;
Executed by:
  • tst_QProcessEnvironment
  • tst_Selftests
2290
166}-
167-
168QProcessEnvironment QProcessEnvironmentPrivate::fromList(const QStringList &list)-
169{-
170 QProcessEnvironment env;-
171 QStringList::ConstIterator it = list.constBegin(),-
172 end = list.constEnd();-
173 for ( ; it != end; ++it) {
it != endDescription
TRUEevaluated 4176 times by 4 tests
Evaluated by:
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qmake
  • tst_qmessagehandler
FALSEevaluated 137 times by 4 tests
Evaluated by:
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qmake
  • tst_qmessagehandler
137-4176
174 int pos = it->indexOf(QLatin1Char('='), 1);-
175 if (pos < 1)
pos < 1Description
TRUEnever evaluated
FALSEevaluated 4176 times by 4 tests
Evaluated by:
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qmake
  • tst_qmessagehandler
0-4176
176 continue;
never executed: continue;
0
177-
178 QString value = it->mid(pos + 1);-
179 QString name = *it;-
180 name.truncate(pos);-
181 env.insert(name, value);-
182 }
executed 4176 times by 4 tests: end of block
Executed by:
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qmake
  • tst_qmessagehandler
4176
183 return env;
executed 137 times by 4 tests: return env;
Executed by:
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qmake
  • tst_qmessagehandler
137
184}-
185-
186QStringList QProcessEnvironmentPrivate::keys() const-
187{-
188 QStringList result;-
189 result.reserve(hash.size());-
190 Hash::ConstIterator it = hash.constBegin(),-
191 end = hash.constEnd();-
192 for ( ; it != end; ++it)
it != endDescription
TRUEevaluated 41 times by 2 tests
Evaluated by:
  • tst_QProcessEnvironment
  • tst_Selftests
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QProcessEnvironment
  • tst_Selftests
5-41
193 result << nameToString(it.key());
executed 41 times by 2 tests: result << nameToString(it.key());
Executed by:
  • tst_QProcessEnvironment
  • tst_Selftests
41
194 return result;
executed 5 times by 2 tests: return result;
Executed by:
  • tst_QProcessEnvironment
  • tst_Selftests
5
195}-
196-
197void QProcessEnvironmentPrivate::insert(const QProcessEnvironmentPrivate &other)-
198{-
199 Hash::ConstIterator it = other.hash.constBegin(),-
200 end = other.hash.constEnd();-
201 for ( ; it != end; ++it)
it != endDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QProcessEnvironment
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QProcessEnvironment
2-6
202 hash.insert(it.key(), it.value());
executed 6 times by 1 test: hash.insert(it.key(), it.value());
Executed by:
  • tst_QProcessEnvironment
6
203-
204#ifdef Q_OS_UNIX-
205 QHash<QString, Key>::ConstIterator nit = other.nameMap.constBegin(),-
206 nend = other.nameMap.constEnd();-
207 for ( ; nit != nend; ++nit)
nit != nendDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QProcessEnvironment
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QProcessEnvironment
2-6
208 nameMap.insert(nit.key(), nit.value());
executed 6 times by 1 test: nameMap.insert(nit.key(), nit.value());
Executed by:
  • tst_QProcessEnvironment
6
209#endif-
210}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QProcessEnvironment
2
211-
212/*!-
213 Creates a new QProcessEnvironment object. This constructor creates an-
214 empty environment. If set on a QProcess, this will cause the current-
215 environment variables to be removed.-
216*/-
217QProcessEnvironment::QProcessEnvironment()-
218 : d(0)-
219{-
220}
executed 2787 times by 36 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcessEnvironment
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • ...
2787
221-
222/*!-
223 Frees the resources associated with this QProcessEnvironment object.-
224*/-
225QProcessEnvironment::~QProcessEnvironment()-
226{-
227}-
228-
229/*!-
230 Creates a QProcessEnvironment object that is a copy of \a other.-
231*/-
232QProcessEnvironment::QProcessEnvironment(const QProcessEnvironment &other)-
233 : d(other.d)-
234{-
235}
executed 789 times by 1 test: end of block
Executed by:
  • tst_Selftests
789
236-
237/*!-
238 Copies the contents of the \a other QProcessEnvironment object into this-
239 one.-
240*/-
241QProcessEnvironment &QProcessEnvironment::operator=(const QProcessEnvironment &other)-
242{-
243 d = other.d;-
244 return *this;
executed 1281 times by 6 tests: return *this;
Executed by:
  • tst_QProcess
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
1281
245}-
246-
247/*!-
248 \fn void QProcessEnvironment::swap(QProcessEnvironment &other)-
249 \since 5.0-
250-
251 Swaps this process environment instance with \a other. This-
252 function is very fast and never fails.-
253*/-
254-
255/*!-
256 \fn bool QProcessEnvironment::operator !=(const QProcessEnvironment &other) const-
257-
258 Returns \c true if this and the \a other QProcessEnvironment objects are different.-
259-
260 \sa operator==()-
261*/-
262-
263/*!-
264 Returns \c true if this and the \a other QProcessEnvironment objects are equal.-
265-
266 Two QProcessEnvironment objects are considered equal if they have the same-
267 set of key=value pairs. The comparison of keys is done case-sensitive on-
268 platforms where the environment is case-sensitive.-
269-
270 \sa operator!=(), contains()-
271*/-
272bool QProcessEnvironment::operator==(const QProcessEnvironment &other) const-
273{-
274 if (d == other.d)
d == other.dDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QProcessEnvironment
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QProcessEnvironment
3-6
275 return true;
executed 3 times by 1 test: return true;
Executed by:
  • tst_QProcessEnvironment
3
276 if (d) {
dDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QProcessEnvironment
FALSEnever evaluated
0-6
277 if (other.d) {
other.dDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QProcessEnvironment
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QProcessEnvironment
1-5
278 QProcessEnvironmentPrivate::OrderedMutexLocker locker(d, other.d);-
279 return d->hash == other.d->hash;
executed 5 times by 1 test: return d->hash == other.d->hash;
Executed by:
  • tst_QProcessEnvironment
5
280 } else {-
281 return isEmpty();
executed 1 time by 1 test: return isEmpty();
Executed by:
  • tst_QProcessEnvironment
1
282 }-
283 } else {-
284 return other.isEmpty();
never executed: return other.isEmpty();
0
285 }-
286}-
287-
288/*!-
289 Returns \c true if this QProcessEnvironment object is empty: that is-
290 there are no key=value pairs set.-
291-
292 \sa clear(), systemEnvironment(), insert()-
293*/-
294bool QProcessEnvironment::isEmpty() const-
295{-
296 // Needs no locking, as no hash nodes are accessed-
297 return d ? d->hash.isEmpty() : true;
executed 800 times by 4 tests: return d ? d->hash.isEmpty() : true;
Executed by:
  • tst_QProcess
  • tst_QProcessEnvironment
  • tst_Selftests
  • tst_qmakelib
800
298}-
299-
300/*!-
301 Removes all key=value pairs from this QProcessEnvironment object, making-
302 it empty.-
303-
304 \sa isEmpty(), systemEnvironment()-
305*/-
306void QProcessEnvironment::clear()-
307{-
308 if (d)
dDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QProcessEnvironment
FALSEnever evaluated
0-7
309 d->hash.clear();
executed 7 times by 1 test: d->hash.clear();
Executed by:
  • tst_QProcessEnvironment
7
310 // Unix: Don't clear d->nameMap, as the environment is likely to be-
311 // re-populated with the same keys again.-
312}
executed 7 times by 1 test: end of block
Executed by:
  • tst_QProcessEnvironment
7
313-
314/*!-
315 Returns \c true if the environment variable of name \a name is found in-
316 this QProcessEnvironment object.-
317-
318-
319 \sa insert(), value()-
320*/-
321bool QProcessEnvironment::contains(const QString &name) const-
322{-
323 if (!d)
!dDescription
TRUEnever evaluated
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_QProcessEnvironment
0-14
324 return false;
never executed: return false;
0
325 QProcessEnvironmentPrivate::MutexLocker locker(d);-
326 return d->hash.contains(d->prepareName(name));
executed 14 times by 2 tests: return d->hash.contains(d->prepareName(name));
Executed by:
  • tst_QProcess
  • tst_QProcessEnvironment
14
327}-
328-
329/*!-
330 Inserts the environment variable of name \a name and contents \a value-
331 into this QProcessEnvironment object. If that variable already existed,-
332 it is replaced by the new value.-
333-
334 On most systems, inserting a variable with no contents will have the-
335 same effect for applications as if the variable had not been set at all.-
336 However, to guarantee that there are no incompatibilities, to remove a-
337 variable, please use the remove() function.-
338-
339 \sa contains(), remove(), value()-
340*/-
341void QProcessEnvironment::insert(const QString &name, const QString &value)-
342{-
343 // our re-impl of detach() detaches from null-
344 d.detach(); // detach before prepareName()-
345 d->hash.insert(d->prepareName(name), d->prepareValue(value));-
346}
executed 4296 times by 7 tests: end of block
Executed by:
  • tst_QProcess
  • tst_QProcessEnvironment
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
4296
347-
348/*!-
349 Removes the environment variable identified by \a name from this-
350 QProcessEnvironment object. If that variable did not exist before,-
351 nothing happens.-
352-
353-
354 \sa contains(), insert(), value()-
355*/-
356void QProcessEnvironment::remove(const QString &name)-
357{-
358 if (d) {
dDescription
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_QProcessEnvironment
FALSEnever evaluated
0-3
359 d.detach(); // detach before prepareName()-
360 d->hash.remove(d->prepareName(name));-
361 }
executed 3 times by 2 tests: end of block
Executed by:
  • tst_QProcess
  • tst_QProcessEnvironment
3
362}
executed 3 times by 2 tests: end of block
Executed by:
  • tst_QProcess
  • tst_QProcessEnvironment
3
363-
364/*!-
365 Searches this QProcessEnvironment object for a variable identified by-
366 \a name and returns its value. If the variable is not found in this object,-
367 then \a defaultValue is returned instead.-
368-
369 \sa contains(), insert(), remove()-
370*/-
371QString QProcessEnvironment::value(const QString &name, const QString &defaultValue) const-
372{-
373 if (!d)
!dDescription
TRUEnever evaluated
FALSEevaluated 38 times by 3 tests
Evaluated by:
  • tst_QProcessEnvironment
  • tst_Selftests
  • tst_qmakelib
0-38
374 return defaultValue;
never executed: return defaultValue;
0
375-
376 QProcessEnvironmentPrivate::MutexLocker locker(d);-
377 QProcessEnvironmentPrivate::Hash::ConstIterator it = d->hash.constFind(d->prepareName(name));-
378 if (it == d->hash.constEnd())
it == d->hash.constEnd()Description
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QProcessEnvironment
  • tst_qmakelib
FALSEevaluated 28 times by 3 tests
Evaluated by:
  • tst_QProcessEnvironment
  • tst_Selftests
  • tst_qmakelib
10-28
379 return defaultValue;
executed 10 times by 2 tests: return defaultValue;
Executed by:
  • tst_QProcessEnvironment
  • tst_qmakelib
10
380-
381 return d->valueToString(it.value());
executed 28 times by 3 tests: return d->valueToString(it.value());
Executed by:
  • tst_QProcessEnvironment
  • tst_Selftests
  • tst_qmakelib
28
382}-
383-
384/*!-
385 Converts this QProcessEnvironment object into a list of strings, one for-
386 each environment variable that is set. The environment variable's name-
387 and its value are separated by an equal character ('=').-
388-
389 The QStringList contents returned by this function are suitable for-
390 presentation.-
391 Use with the QProcess::setEnvironment function is not recommended due to-
392 potential encoding problems under Unix, and worse performance.-
393-
394 \sa systemEnvironment(), QProcess::systemEnvironment(),-
395 QProcess::setProcessEnvironment()-
396*/-
397QStringList QProcessEnvironment::toStringList() const-
398{-
399 if (!d)
!dDescription
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_QProcessEnvironment
FALSEevaluated 2290 times by 2 tests
Evaluated by:
  • tst_QProcessEnvironment
  • tst_Selftests
2-2290
400 return QStringList();
executed 2 times by 2 tests: return QStringList();
Executed by:
  • tst_QProcess
  • tst_QProcessEnvironment
2
401 QProcessEnvironmentPrivate::MutexLocker locker(d);-
402 return d->toList();
executed 2290 times by 2 tests: return d->toList();
Executed by:
  • tst_QProcessEnvironment
  • tst_Selftests
2290
403}-
404-
405/*!-
406 \since 4.8-
407-
408 Returns a list containing all the variable names in this QProcessEnvironment-
409 object.-
410*/-
411QStringList QProcessEnvironment::keys() const-
412{-
413 if (!d)
!dDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QProcessEnvironment
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QProcessEnvironment
  • tst_Selftests
1-5
414 return QStringList();
executed 1 time by 1 test: return QStringList();
Executed by:
  • tst_QProcessEnvironment
1
415 QProcessEnvironmentPrivate::MutexLocker locker(d);-
416 return d->keys();
executed 5 times by 2 tests: return d->keys();
Executed by:
  • tst_QProcessEnvironment
  • tst_Selftests
5
417}-
418-
419/*!-
420 \overload-
421 \since 4.8-
422-
423 Inserts the contents of \a e in this QProcessEnvironment object. Variables in-
424 this object that also exist in \a e will be overwritten.-
425*/-
426void QProcessEnvironment::insert(const QProcessEnvironment &e)-
427{-
428 if (!e.d)
!e.dDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QProcessEnvironment
0-2
429 return;
never executed: return;
0
430-
431 // our re-impl of detach() detaches from null-
432 QProcessEnvironmentPrivate::MutexLocker locker(e.d);-
433 d->insert(*e.d);-
434}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QProcessEnvironment
2
435-
436void QProcessPrivate::Channel::clear()-
437{-
438 switch (type) {-
439 case PipeSource:
executed 3 times by 1 test: case PipeSource:
Executed by:
  • tst_QProcess
3
440 Q_ASSERT(process);-
441 process->stdinChannel.type = Normal;-
442 process->stdinChannel.process = 0;-
443 break;
executed 3 times by 1 test: break;
Executed by:
  • tst_QProcess
3
444 case PipeSink:
never executed: case PipeSink:
0
445 Q_ASSERT(process);-
446 process->stdoutChannel.type = Normal;-
447 process->stdoutChannel.process = 0;-
448 break;
never executed: break;
0
449 }-
450-
451 type = Normal;-
452 file.clear();-
453 process = 0;-
454}
executed 21 times by 1 test: end of block
Executed by:
  • tst_QProcess
21
455-
456/*! \fn bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid)-
457-
458\internal-
459 */-
460-
461/*!-
462 \class QProcess-
463 \inmodule QtCore-
464-
465 \brief The QProcess class is used to start external programs and-
466 to communicate with them.-
467-
468 \ingroup io-
469-
470 \reentrant-
471-
472 \section1 Running a Process-
473-
474 To start a process, pass the name and command line arguments of-
475 the program you want to run as arguments to start(). Arguments-
476 are supplied as individual strings in a QStringList.-
477-
478 Alternatively, you can set the program to run with setProgram()-
479 and setArguments(), and then call start() or open().-
480-
481 For example, the following code snippet runs the analog clock-
482 example in the Fusion style on X11 platforms by passing strings-
483 containing "-style" and "fusion" as two items in the list of-
484 arguments:-
485-
486 \snippet qprocess/qprocess-simpleexecution.cpp 0-
487 \dots-
488 \snippet qprocess/qprocess-simpleexecution.cpp 1-
489 \snippet qprocess/qprocess-simpleexecution.cpp 2-
490-
491 QProcess then enters the \l Starting state, and when the program-
492 has started, QProcess enters the \l Running state and emits-
493 started().-
494-
495 QProcess allows you to treat a process as a sequential I/O-
496 device. You can write to and read from the process just as you-
497 would access a network connection using QTcpSocket. You can then-
498 write to the process's standard input by calling write(), and-
499 read the standard output by calling read(), readLine(), and-
500 getChar(). Because it inherits QIODevice, QProcess can also be-
501 used as an input source for QXmlReader, or for generating data to-
502 be uploaded using QNetworkAccessManager.-
503-
504 When the process exits, QProcess reenters the \l NotRunning state-
505 (the initial state), and emits finished().-
506-
507 The finished() signal provides the exit code and exit status of-
508 the process as arguments, and you can also call exitCode() to-
509 obtain the exit code of the last process that finished, and-
510 exitStatus() to obtain its exit status. If an error occurs at-
511 any point in time, QProcess will emit the errorOccurred() signal.-
512 You can also call error() to find the type of error that occurred-
513 last, and state() to find the current process state.-
514-
515 \section1 Communicating via Channels-
516-
517 Processes have two predefined output channels: The standard-
518 output channel (\c stdout) supplies regular console output, and-
519 the standard error channel (\c stderr) usually supplies the-
520 errors that are printed by the process. These channels represent-
521 two separate streams of data. You can toggle between them by-
522 calling setReadChannel(). QProcess emits readyRead() when data is-
523 available on the current read channel. It also emits-
524 readyReadStandardOutput() when new standard output data is-
525 available, and when new standard error data is available,-
526 readyReadStandardError() is emitted. Instead of calling read(),-
527 readLine(), or getChar(), you can explicitly read all data from-
528 either of the two channels by calling readAllStandardOutput() or-
529 readAllStandardError().-
530-
531 The terminology for the channels can be misleading. Be aware that-
532 the process's output channels correspond to QProcess's-
533 \e read channels, whereas the process's input channels correspond-
534 to QProcess's \e write channels. This is because what we read-
535 using QProcess is the process's output, and what we write becomes-
536 the process's input.-
537-
538 QProcess can merge the two output channels, so that standard-
539 output and standard error data from the running process both use-
540 the standard output channel. Call setProcessChannelMode() with-
541 MergedChannels before starting the process to activate-
542 this feature. You also have the option of forwarding the output of-
543 the running process to the calling, main process, by passing-
544 ForwardedChannels as the argument. It is also possible to forward-
545 only one of the output channels - typically one would use-
546 ForwardedErrorChannel, but ForwardedOutputChannel also exists.-
547 Note that using channel forwarding is typically a bad idea in GUI-
548 applications - you should present errors graphically instead.-
549-
550 Certain processes need special environment settings in order to-
551 operate. You can set environment variables for your process by-
552 calling setProcessEnvironment(). To set a working directory, call-
553 setWorkingDirectory(). By default, processes are run in the-
554 current working directory of the calling process.-
555-
556 The positioning and the screen Z-order of windows belonging to-
557 GUI applications started with QProcess are controlled by-
558 the underlying windowing system. For Qt 5 applications, the-
559 positioning can be specified using the \c{-qwindowgeometry}-
560 command line option; X11 applications generally accept a-
561 \c{-geometry} command line option.-
562-
563 \note On QNX, setting the working directory may cause all-
564 application threads, with the exception of the QProcess caller-
565 thread, to temporarily freeze during the spawning process,-
566 owing to a limitation in the operating system.-
567-
568 \section1 Synchronous Process API-
569-
570 QProcess provides a set of functions which allow it to be used-
571 without an event loop, by suspending the calling thread until-
572 certain signals are emitted:-
573-
574 \list-
575 \li waitForStarted() blocks until the process has started.-
576-
577 \li waitForReadyRead() blocks until new data is-
578 available for reading on the current read channel.-
579-
580 \li waitForBytesWritten() blocks until one payload of-
581 data has been written to the process.-
582-
583 \li waitForFinished() blocks until the process has finished.-
584 \endlist-
585-
586 Calling these functions from the main thread (the thread that-
587 calls QApplication::exec()) may cause your user interface to-
588 freeze.-
589-
590 The following example runs \c gzip to compress the string "Qt-
591 rocks!", without an event loop:-
592-
593 \snippet process/process.cpp 0-
594-
595 \section1 Notes for Windows Users-
596-
597 Some Windows commands (for example, \c dir) are not provided by-
598 separate applications, but by the command interpreter itself.-
599 If you attempt to use QProcess to execute these commands directly,-
600 it won't work. One possible solution is to execute the command-
601 interpreter itself (\c{cmd.exe} on some Windows systems), and ask-
602 the interpreter to execute the desired command.-
603-
604 \sa QBuffer, QFile, QTcpSocket-
605*/-
606-
607/*!-
608 \enum QProcess::ProcessChannel-
609-
610 This enum describes the process channels used by the running process.-
611 Pass one of these values to setReadChannel() to set the-
612 current read channel of QProcess.-
613-
614 \value StandardOutput The standard output (stdout) of the running-
615 process.-
616-
617 \value StandardError The standard error (stderr) of the running-
618 process.-
619-
620 \sa setReadChannel()-
621*/-
622-
623/*!-
624 \enum QProcess::ProcessChannelMode-
625-
626 This enum describes the process output channel modes of QProcess.-
627 Pass one of these values to setProcessChannelMode() to set the-
628 current read channel mode.-
629-
630 \value SeparateChannels QProcess manages the output of the-
631 running process, keeping standard output and standard error data-
632 in separate internal buffers. You can select the QProcess's-
633 current read channel by calling setReadChannel(). This is the-
634 default channel mode of QProcess.-
635-
636 \value MergedChannels QProcess merges the output of the running-
637 process into the standard output channel (\c stdout). The-
638 standard error channel (\c stderr) will not receive any data. The-
639 standard output and standard error data of the running process-
640 are interleaved.-
641-
642 \value ForwardedChannels QProcess forwards the output of the-
643 running process onto the main process. Anything the child process-
644 writes to its standard output and standard error will be written-
645 to the standard output and standard error of the main process.-
646-
647 \value ForwardedErrorChannel QProcess manages the standard output-
648 of the running process, but forwards its standard error onto the-
649 main process. This reflects the typical use of command line tools-
650 as filters, where the standard output is redirected to another-
651 process or a file, while standard error is printed to the console-
652 for diagnostic purposes.-
653 (This value was introduced in Qt 5.2.)-
654-
655 \value ForwardedOutputChannel Complementary to ForwardedErrorChannel.-
656 (This value was introduced in Qt 5.2.)-
657-
658 \note Windows intentionally suppresses output from GUI-only-
659 applications to inherited consoles.-
660 This does \e not apply to output redirected to files or pipes.-
661 To forward the output of GUI-only applications on the console-
662 nonetheless, you must use SeparateChannels and do the forwarding-
663 yourself by reading the output and writing it to the appropriate-
664 output channels.-
665-
666 \sa setProcessChannelMode()-
667*/-
668-
669/*!-
670 \enum QProcess::InputChannelMode-
671 \since 5.2-
672-
673 This enum describes the process input channel modes of QProcess.-
674 Pass one of these values to setInputChannelMode() to set the-
675 current write channel mode.-
676-
677 \value ManagedInputChannel QProcess manages the input of the running-
678 process. This is the default input channel mode of QProcess.-
679-
680 \value ForwardedInputChannel QProcess forwards the input of the main-
681 process onto the running process. The child process reads its standard-
682 input from the same source as the main process.-
683 Note that the main process must not try to read its standard input-
684 while the child process is running.-
685-
686 \sa setInputChannelMode()-
687*/-
688-
689/*!-
690 \enum QProcess::ProcessError-
691-
692 This enum describes the different types of errors that are-
693 reported by QProcess.-
694-
695 \value FailedToStart The process failed to start. Either the-
696 invoked program is missing, or you may have insufficient-
697 permissions to invoke the program.-
698-
699 \value Crashed The process crashed some time after starting-
700 successfully.-
701-
702 \value Timedout The last waitFor...() function timed out. The-
703 state of QProcess is unchanged, and you can try calling-
704 waitFor...() again.-
705-
706 \value WriteError An error occurred when attempting to write to the-
707 process. For example, the process may not be running, or it may-
708 have closed its input channel.-
709-
710 \value ReadError An error occurred when attempting to read from-
711 the process. For example, the process may not be running.-
712-
713 \value UnknownError An unknown error occurred. This is the default-
714 return value of error().-
715-
716 \sa error()-
717*/-
718-
719/*!-
720 \enum QProcess::ProcessState-
721-
722 This enum describes the different states of QProcess.-
723-
724 \value NotRunning The process is not running.-
725-
726 \value Starting The process is starting, but the program has not-
727 yet been invoked.-
728-
729 \value Running The process is running and is ready for reading and-
730 writing.-
731-
732 \sa state()-
733*/-
734-
735/*!-
736 \enum QProcess::ExitStatus-
737-
738 This enum describes the different exit statuses of QProcess.-
739-
740 \value NormalExit The process exited normally.-
741-
742 \value CrashExit The process crashed.-
743-
744 \sa exitStatus()-
745*/-
746-
747/*!-
748 \typedef QProcess::CreateProcessArgumentModifier-
749 \note This typedef is only available on desktop Windows.-
750-
751 On Windows, QProcess uses the Win32 API function \c CreateProcess to-
752 start child processes. While QProcess provides a comfortable way to start-
753 processes without worrying about platform-
754 details, it is in some cases desirable to fine-tune the parameters that are-
755 passed to \c CreateProcess. This is done by defining a-
756 \c CreateProcessArgumentModifier function and passing it to-
757 \c setCreateProcessArgumentsModifier.-
758-
759 A \c CreateProcessArgumentModifier function takes one parameter: a pointer-
760 to a \c CreateProcessArguments struct. The members of this struct will be-
761 passed to \c CreateProcess after the \c CreateProcessArgumentModifier-
762 function is called.-
763-
764 The following example demonstrates how to pass custom flags to-
765 \c CreateProcess.-
766 When starting a console process B from a console process A, QProcess will-
767 reuse the console window of process A for process B by default. In this-
768 example, a new console window with a custom color scheme is created for the-
769 child process B instead.-
770-
771 \snippet qprocess/qprocess-createprocessargumentsmodifier.cpp 0-
772-
773 \sa QProcess::CreateProcessArguments-
774 \sa setCreateProcessArgumentsModifier()-
775*/-
776-
777/*!-
778 \class QProcess::CreateProcessArguments-
779 \note This struct is only available on the Windows platform.-
780-
781 This struct is a representation of all parameters of the Windows API-
782 function \c CreateProcess. It is used as parameter for-
783 \c CreateProcessArgumentModifier functions.-
784-
785 \sa QProcess::CreateProcessArgumentModifier-
786*/-
787-
788/*!-
789 \fn void QProcess::error(QProcess::ProcessError error)-
790 \obsolete-
791-
792 Use errorOccurred() instead.-
793*/-
794-
795/*!-
796 \fn void QProcess::errorOccurred(QProcess::ProcessError error)-
797 \since 5.6-
798-
799 This signal is emitted when an error occurs with the process. The-
800 specified \a error describes the type of error that occurred.-
801*/-
802-
803/*!-
804 \fn void QProcess::started()-
805-
806 This signal is emitted by QProcess when the process has started,-
807 and state() returns \l Running.-
808*/-
809-
810/*!-
811 \fn void QProcess::stateChanged(QProcess::ProcessState newState)-
812-
813 This signal is emitted whenever the state of QProcess changes. The-
814 \a newState argument is the state QProcess changed to.-
815*/-
816-
817/*!-
818 \fn void QProcess::finished(int exitCode)-
819 \obsolete-
820 \overload-
821-
822 Use finished(int exitCode, QProcess::ExitStatus status) instead.-
823*/-
824-
825/*!-
826 \fn void QProcess::finished(int exitCode, QProcess::ExitStatus exitStatus)-
827-
828 This signal is emitted when the process finishes. \a exitCode is the exit-
829 code of the process (only valid for normal exits), and \a exitStatus is-
830 the exit status.-
831 After the process has finished, the buffers in QProcess are still intact.-
832 You can still read any data that the process may have written before it-
833 finished.-
834-
835 \sa exitStatus()-
836*/-
837-
838/*!-
839 \fn void QProcess::readyReadStandardOutput()-
840-
841 This signal is emitted when the process has made new data-
842 available through its standard output channel (\c stdout). It is-
843 emitted regardless of the current \l{readChannel()}{read channel}.-
844-
845 \sa readAllStandardOutput(), readChannel()-
846*/-
847-
848/*!-
849 \fn void QProcess::readyReadStandardError()-
850-
851 This signal is emitted when the process has made new data-
852 available through its standard error channel (\c stderr). It is-
853 emitted regardless of the current \l{readChannel()}{read-
854 channel}.-
855-
856 \sa readAllStandardError(), readChannel()-
857*/-
858-
859/*!-
860 \internal-
861*/-
862QProcessPrivate::QProcessPrivate()-
863{-
864 readBufferChunkSize = QRINGBUFFER_CHUNKSIZE;-
865 writeBufferChunkSize = QRINGBUFFER_CHUNKSIZE;-
866 processChannelMode = QProcess::SeparateChannels;-
867 inputChannelMode = QProcess::ManagedInputChannel;-
868 processError = QProcess::UnknownError;-
869 processState = QProcess::NotRunning;-
870 pid = 0;-
871 sequenceNumber = 0;-
872 exitCode = 0;-
873 exitStatus = QProcess::NormalExit;-
874 startupSocketNotifier = 0;-
875 deathNotifier = 0;-
876 childStartedPipe[0] = INVALID_Q_PIPE;-
877 childStartedPipe[1] = INVALID_Q_PIPE;-
878 forkfd = -1;-
879 crashed = false;-
880 dying = false;-
881 emittedReadyRead = false;-
882 emittedBytesWritten = false;-
883#ifdef Q_OS_WIN-
884 stdinWriteTrigger = 0;-
885 processFinishedNotifier = 0;-
886#endif // Q_OS_WIN-
887}
executed 2280 times by 35 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • ...
2280
888-
889/*!-
890 \internal-
891*/-
892QProcessPrivate::~QProcessPrivate()-
893{-
894 if (stdinChannel.process)
stdinChannel.processDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 2281 times by 40 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • ...
3-2281
895 stdinChannel.process->stdoutChannel.clear();
executed 3 times by 1 test: stdinChannel.process->stdoutChannel.clear();
Executed by:
  • tst_QProcess
3
896 if (stdoutChannel.process)
stdoutChannel.processDescription
TRUEnever evaluated
FALSEevaluated 2284 times by 40 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • ...
0-2284
897 stdoutChannel.process->stdinChannel.clear();
never executed: stdoutChannel.process->stdinChannel.clear();
0
898}
executed 2284 times by 40 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • ...
2284
899-
900/*!-
901 \internal-
902*/-
903void QProcessPrivate::cleanup()-
904{-
905 q_func()->setProcessState(QProcess::NotRunning);-
906#ifdef Q_OS_WIN-
907 if (pid) {-
908 CloseHandle(pid->hThread);-
909 CloseHandle(pid->hProcess);-
910 delete pid;-
911 pid = 0;-
912 }-
913 if (stdinWriteTrigger) {-
914 delete stdinWriteTrigger;-
915 stdinWriteTrigger = 0;-
916 }-
917 if (processFinishedNotifier) {-
918 delete processFinishedNotifier;-
919 processFinishedNotifier = 0;-
920 }-
921-
922#endif-
923 pid = 0;-
924 sequenceNumber = 0;-
925 dying = false;-
926-
927 if (stdoutChannel.notifier) {
stdoutChannel.notifierDescription
TRUEevaluated 2932 times by 37 tests
Evaluated by:
  • tst_Lancelot
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • ...
FALSEevaluated 2375 times by 40 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • ...
2375-2932
928 delete stdoutChannel.notifier;-
929 stdoutChannel.notifier = 0;-
930 }
executed 2932 times by 37 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • ...
2932
931 if (stderrChannel.notifier) {
stderrChannel.notifierDescription
TRUEevaluated 2921 times by 36 tests
Evaluated by:
  • tst_Lancelot
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • ...
FALSEevaluated 2386 times by 40 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • ...
2386-2921
932 delete stderrChannel.notifier;-
933 stderrChannel.notifier = 0;-
934 }
executed 2921 times by 36 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • ...
2921
935 if (stdinChannel.notifier) {
stdinChannel.notifierDescription
TRUEevaluated 2308 times by 34 tests
Evaluated by:
  • tst_Lancelot
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • ...
FALSEevaluated 2999 times by 40 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • ...
2308-2999
936 delete stdinChannel.notifier;-
937 stdinChannel.notifier = 0;-
938 }
executed 2308 times by 34 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • ...
2308
939 if (startupSocketNotifier) {
startupSocketNotifierDescription
TRUEnever evaluated
FALSEevaluated 5307 times by 44 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
0-5307
940 delete startupSocketNotifier;-
941 startupSocketNotifier = 0;-
942 }
never executed: end of block
0
943 if (deathNotifier) {
deathNotifierDescription
TRUEnever evaluated
FALSEevaluated 5307 times by 44 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
0-5307
944 delete deathNotifier;-
945 deathNotifier = 0;-
946 }
never executed: end of block
0
947 closeChannel(&stdoutChannel);-
948 closeChannel(&stderrChannel);-
949 closeChannel(&stdinChannel);-
950 destroyPipe(childStartedPipe);-
951#ifdef Q_OS_UNIX-
952 if (forkfd != -1)
forkfd != -1Description
TRUEnever evaluated
FALSEevaluated 5307 times by 44 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
0-5307
953 qt_safe_close(forkfd);
never executed: qt_safe_close(forkfd);
0
954 forkfd = -1;-
955#endif-
956}
executed 5307 times by 44 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
5307
957-
958/*!-
959 \internal-
960*/-
961void QProcessPrivate::setError(QProcess::ProcessError error, const QString &description)-
962{-
963 processError = error;-
964 if (description.isEmpty()) {
description.isEmpty()Description
TRUEevaluated 119 times by 6 tests
Evaluated by:
  • tst_QNetworkSession
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSystemSemaphore
  • tst_Selftests
FALSEevaluated 710 times by 11 tests
Evaluated by:
  • tst_QCommandLineParser
  • tst_QFile
  • tst_QLockFile
  • tst_QProcess
  • tst_QSharedPointer
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
119-710
965 switch (error) {-
966 case QProcess::FailedToStart:
never executed: case QProcess::FailedToStart:
0
967 errorString = QProcess::tr("Process failed to start");-
968 break;
never executed: break;
0
969 case QProcess::Crashed:
executed 103 times by 5 tests: case QProcess::Crashed:
Executed by:
  • tst_QNetworkSession
  • tst_QProcess
  • tst_QSharedMemory
  • tst_QSystemSemaphore
  • tst_Selftests
103
970 errorString = QProcess::tr("Process crashed");-
971 break;
executed 103 times by 5 tests: break;
Executed by:
  • tst_QNetworkSession
  • tst_QProcess
  • tst_QSharedMemory
  • tst_QSystemSemaphore
  • tst_Selftests
103
972 case QProcess::Timedout:
executed 11 times by 3 tests: case QProcess::Timedout:
Executed by:
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSystemSemaphore
11
973 errorString = QProcess::tr("Process operation timed out");-
974 break;
executed 11 times by 3 tests: break;
Executed by:
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSystemSemaphore
11
975 case QProcess::ReadError:
never executed: case QProcess::ReadError:
0
976 errorString = QProcess::tr("Error reading from process");-
977 break;
never executed: break;
0
978 case QProcess::WriteError:
executed 5 times by 1 test: case QProcess::WriteError:
Executed by:
  • tst_QProcess
5
979 errorString = QProcess::tr("Error writing to process");-
980 break;
executed 5 times by 1 test: break;
Executed by:
  • tst_QProcess
5
981 case QProcess::UnknownError:
never executed: case QProcess::UnknownError:
0
982 errorString.clear();-
983 break;
never executed: break;
0
984 }-
985 } else {
executed 119 times by 6 tests: end of block
Executed by:
  • tst_QNetworkSession
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSystemSemaphore
  • tst_Selftests
119
986 errorString = description;-
987 }
executed 710 times by 11 tests: end of block
Executed by:
  • tst_QCommandLineParser
  • tst_QFile
  • tst_QLockFile
  • tst_QProcess
  • tst_QSharedPointer
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
710
988}-
989-
990/*!-
991 \internal-
992*/-
993void QProcessPrivate::setErrorAndEmit(QProcess::ProcessError error, const QString &description)-
994{-
995 Q_Q(QProcess);-
996 Q_ASSERT(error != QProcess::UnknownError);-
997 setError(error, description);-
998 emit q->errorOccurred(processError);-
999 emit q->error(processError);-
1000}
executed 818 times by 15 tests: end of block
Executed by:
  • tst_QCommandLineParser
  • tst_QFile
  • tst_QLockFile
  • tst_QNetworkSession
  • tst_QProcess
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_Selftests
818
1001-
1002/*!-
1003 \internal-
1004 Returns true if we emitted readyRead().-
1005*/-
1006bool QProcessPrivate::tryReadFromChannel(Channel *channel)-
1007{-
1008 Q_Q(QProcess);-
1009 if (channel->pipe[0] == INVALID_Q_PIPE)
channel->pipe[0] == -1Description
TRUEevaluated 4635 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
FALSEevaluated 37468 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
4635-37468
1010 return false;
executed 4635 times by 30 tests: return false;
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
4635
1011-
1012 qint64 available = bytesAvailableInChannel(channel);-
1013 if (available == 0)
available == 0Description
TRUEevaluated 4607 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
FALSEevaluated 32861 times by 26 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • ...
4607-32861
1014 available = 1; // always try to read at least one byte
executed 4607 times by 30 tests: available = 1;
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
4607
1015-
1016 QProcess::ProcessChannel channelIdx = (channel == &stdoutChannel
channel == &stdoutChannelDescription
TRUEevaluated 34371 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
FALSEevaluated 3097 times by 29 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • ...
3097-34371
1017 ? QProcess::StandardOutput-
1018 : QProcess::StandardError);-
1019 Q_ASSERT(readBuffers.size() > int(channelIdx));-
1020 QRingBuffer &readBuffer = readBuffers[int(channelIdx)];-
1021 char *ptr = readBuffer.reserve(available);-
1022 qint64 readBytes = readFromChannel(channel, ptr, available);-
1023 if (readBytes <= 0)
readBytes <= 0Description
TRUEevaluated 4607 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
FALSEevaluated 32861 times by 26 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • ...
4607-32861
1024 readBuffer.chop(available);
executed 4607 times by 30 tests: readBuffer.chop(available);
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
4607
1025 if (readBytes == -2) {
readBytes == -2Description
TRUEnever evaluated
FALSEevaluated 37468 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
0-37468
1026 // EWOULDBLOCK-
1027 return false;
never executed: return false;
0
1028 }-
1029 if (readBytes == -1) {
readBytes == -1Description
TRUEnever evaluated
FALSEevaluated 37468 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
0-37468
1030 setErrorAndEmit(QProcess::ReadError);-
1031#if defined QPROCESS_DEBUG-
1032 qDebug("QProcessPrivate::tryReadFromChannel(%d), failed to read from the process", channel - &stdinChannel);-
1033#endif-
1034 return false;
never executed: return false;
0
1035 }-
1036 if (readBytes == 0) {
readBytes == 0Description
TRUEevaluated 4607 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
FALSEevaluated 32861 times by 26 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • ...
4607-32861
1037 // EOF-
1038 if (channel->notifier)
channel->notifierDescription
TRUEevaluated 4445 times by 28 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • ...
FALSEevaluated 162 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_qdbuscpp2xml
162-4445
1039 channel->notifier->setEnabled(false);
executed 4445 times by 28 tests: channel->notifier->setEnabled(false);
Executed by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • ...
4445
1040 closeChannel(channel);-
1041#if defined QPROCESS_DEBUG-
1042 qDebug("QProcessPrivate::tryReadFromChannel(%d), 0 bytes available", channel - &stdinChannel);-
1043#endif-
1044 return false;
executed 4607 times by 30 tests: return false;
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
4607
1045 }-
1046#if defined QPROCESS_DEBUG-
1047 qDebug("QProcessPrivate::tryReadFromChannel(%d), read %d bytes from the process' output", channel - &stdinChannel-
1048 int(readBytes));-
1049#endif-
1050-
1051 if (channel->closed) {
channel->closedDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 32821 times by 26 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • ...
40-32821
1052 readBuffer.chop(readBytes);-
1053 return false;
executed 40 times by 1 test: return false;
Executed by:
  • tst_QProcess
40
1054 }-
1055-
1056 readBuffer.chop(available - readBytes);-
1057-
1058 bool didRead = false;-
1059 if (readBytes == 0) {
readBytes == 0Description
TRUEnever evaluated
FALSEevaluated 32821 times by 26 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • ...
0-32821
1060 if (channel->notifier)
channel->notifierDescription
TRUEnever evaluated
FALSEnever evaluated
0
1061 channel->notifier->setEnabled(false);
never executed: channel->notifier->setEnabled(false);
0
1062 } else if (currentReadChannel == channelIdx) {
never executed: end of block
currentReadCha... == channelIdxDescription
TRUEevaluated 31666 times by 22 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
FALSEevaluated 1155 times by 11 tests
Evaluated by:
  • tst_Lancelot
  • tst_QIcon
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qmake
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_uic
0-31666
1063 didRead = true;-
1064 if (!emittedReadyRead) {
!emittedReadyReadDescription
TRUEevaluated 31665 times by 22 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QProcess
1-31665
1065 emittedReadyRead = true;-
1066 emit q->readyRead();-
1067 emittedReadyRead = false;-
1068 }
executed 31665 times by 22 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
31665
1069 }
executed 31666 times by 22 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
31666
1070 emit q->channelReadyRead(int(channelIdx));-
1071 if (channelIdx == QProcess::StandardOutput)
channelIdx == ...StandardOutputDescription
TRUEevaluated 32042 times by 22 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
FALSEevaluated 779 times by 11 tests
Evaluated by:
  • tst_Lancelot
  • tst_QIcon
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qmake
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_uic
779-32042
1072 emit q->readyReadStandardOutput(QProcess::QPrivateSignal());
executed 32042 times by 22 tests: q->readyReadStandardOutput(QProcess::QPrivateSignal());
Executed by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
32042
1073 else-
1074 emit q->readyReadStandardError(QProcess::QPrivateSignal());
executed 779 times by 11 tests: q->readyReadStandardError(QProcess::QPrivateSignal());
Executed by:
  • tst_Lancelot
  • tst_QIcon
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qmake
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_uic
779
1075 return didRead;
executed 32821 times by 26 tests: return didRead;
Executed by:
  • tst_Lancelot
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • ...
32821
1076}-
1077-
1078/*!-
1079 \internal-
1080*/-
1081bool QProcessPrivate::_q_canReadStandardOutput()-
1082{-
1083 return tryReadFromChannel(&stdoutChannel);
executed 36690 times by 30 tests: return tryReadFromChannel(&stdoutChannel);
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
36690
1084}-
1085-
1086/*!-
1087 \internal-
1088*/-
1089bool QProcessPrivate::_q_canReadStandardError()-
1090{-
1091 return tryReadFromChannel(&stderrChannel);
executed 5413 times by 30 tests: return tryReadFromChannel(&stderrChannel);
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
5413
1092}-
1093-
1094/*!-
1095 \internal-
1096*/-
1097bool QProcessPrivate::_q_canWrite()-
1098{-
1099 if (stdinChannel.notifier)
stdinChannel.notifierDescription
TRUEevaluated 3630 times by 6 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
FALSEnever evaluated
0-3630
1100 stdinChannel.notifier->setEnabled(false);
executed 3630 times by 6 tests: stdinChannel.notifier->setEnabled(false);
Executed by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
3630
1101-
1102 if (writeBuffer.isEmpty()) {
writeBuffer.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 3630 times by 6 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
0-3630
1103#if defined QPROCESS_DEBUG-
1104 qDebug("QProcessPrivate::canWrite(), not writing anything (empty write buffer).");-
1105#endif-
1106 return false;
never executed: return false;
0
1107 }-
1108-
1109 const bool writeSucceeded = writeToStdin();-
1110-
1111 if (stdinChannel.notifier && !writeBuffer.isEmpty())
stdinChannel.notifierDescription
TRUEevaluated 3630 times by 6 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
FALSEnever evaluated
!writeBuffer.isEmpty()Description
TRUEevaluated 2715 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
FALSEevaluated 915 times by 6 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
0-3630
1112 stdinChannel.notifier->setEnabled(true);
executed 2715 times by 2 tests: stdinChannel.notifier->setEnabled(true);
Executed by:
  • tst_QNetworkReply
  • tst_QProcess
2715
1113 if (writeBuffer.isEmpty() && stdinChannel.closed)
writeBuffer.isEmpty()Description
TRUEevaluated 915 times by 6 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
FALSEevaluated 2715 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
stdinChannel.closedDescription
TRUEevaluated 459 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_qprocess - unknown status
FALSEevaluated 456 times by 4 tests
Evaluated by:
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QTextStream
  • tst_qdbusxml2cpp
456-2715
1114 closeWriteChannel();
executed 459 times by 3 tests: closeWriteChannel();
Executed by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_qprocess - unknown status
459
1115 return writeSucceeded;
executed 3630 times by 6 tests: return writeSucceeded;
Executed by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
3630
1116}-
1117-
1118/*!-
1119 \internal-
1120*/-
1121bool QProcessPrivate::_q_processDied()-
1122{-
1123 Q_Q(QProcess);-
1124#if defined QPROCESS_DEBUG-
1125 qDebug("QProcessPrivate::_q_processDied()");-
1126#endif-
1127#ifdef Q_OS_UNIX-
1128 if (!waitForDeadChild())
!waitForDeadChild()Description
TRUEnever evaluated
FALSEevaluated 2319 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
0-2319
1129 return false;
never executed: return false;
0
1130#endif-
1131#ifdef Q_OS_WIN-
1132 if (processFinishedNotifier)-
1133 processFinishedNotifier->setEnabled(false);-
1134 drainOutputPipes();-
1135#endif-
1136-
1137 // the process may have died before it got a chance to report that it was-
1138 // either running or stopped, so we will call _q_startupNotification() and-
1139 // give it a chance to emit started() or errorOccurred(FailedToStart).-
1140 if (processState == QProcess::Starting) {
processState =...cess::StartingDescription
TRUEevaluated 23 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 2296 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
23-2296
1141 if (!_q_startupNotification())
!_q_startupNotification()Description
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • tst_QProcess
0-23
1142 return true;
never executed: return true;
0
1143 }
executed 23 times by 1 test: end of block
Executed by:
  • tst_QProcess
23
1144-
1145 if (dying) {
dyingDescription
TRUEnever evaluated
FALSEevaluated 2319 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
0-2319
1146 // at this point we know the process is dead. prevent-
1147 // reentering this slot recursively by calling waitForFinished()-
1148 // or opening a dialog inside slots connected to the readyRead-
1149 // signals emitted below.-
1150 return true;
never executed: return true;
0
1151 }-
1152 dying = true;-
1153-
1154 // in case there is data in the pipe line and this slot by chance-
1155 // got called before the read notifications, call these two slots-
1156 // so the data is made available before the process dies.-
1157 _q_canReadStandardOutput();-
1158 _q_canReadStandardError();-
1159-
1160 findExitCode();-
1161-
1162 if (crashed) {
crashedDescription
TRUEevaluated 103 times by 5 tests
Evaluated by:
  • tst_QNetworkSession
  • tst_QProcess
  • tst_QSharedMemory
  • tst_QSystemSemaphore
  • tst_Selftests
FALSEevaluated 2216 times by 28 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • ...
103-2216
1163 exitStatus = QProcess::CrashExit;-
1164 setErrorAndEmit(QProcess::Crashed);-
1165 }
executed 103 times by 5 tests: end of block
Executed by:
  • tst_QNetworkSession
  • tst_QProcess
  • tst_QSharedMemory
  • tst_QSystemSemaphore
  • tst_Selftests
103
1166-
1167 bool wasRunning = (processState == QProcess::Running);-
1168-
1169 cleanup();-
1170-
1171 if (wasRunning) {
wasRunningDescription
TRUEevaluated 2319 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
FALSEnever evaluated
0-2319
1172 // we received EOF now:-
1173 emit q->readChannelFinished();-
1174 // in the future:-
1175 //emit q->standardOutputClosed();-
1176 //emit q->standardErrorClosed();-
1177-
1178 emit q->finished(exitCode);-
1179 emit q->finished(exitCode, exitStatus);-
1180 }
executed 2319 times by 30 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
2319
1181#if defined QPROCESS_DEBUG-
1182 qDebug("QProcessPrivate::_q_processDied() process is dead");-
1183#endif-
1184 return true;
executed 2319 times by 30 tests: return true;
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
2319
1185}-
1186-
1187/*!-
1188 \internal-
1189*/-
1190bool QProcessPrivate::_q_startupNotification()-
1191{-
1192 Q_Q(QProcess);-
1193#if defined QPROCESS_DEBUG-
1194 qDebug("QProcessPrivate::startupNotification()");-
1195#endif-
1196-
1197 if (startupSocketNotifier)
startupSocketNotifierDescription
TRUEevaluated 2942 times by 37 tests
Evaluated by:
  • tst_Lancelot
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • ...
FALSEevaluated 81 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_qdbuscpp2xml
81-2942
1198 startupSocketNotifier->setEnabled(false);
executed 2942 times by 37 tests: startupSocketNotifier->setEnabled(false);
Executed by:
  • tst_Lancelot
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • ...
2942
1199 QString errorMessage;-
1200 if (processStarted(&errorMessage)) {
processStarted(&errorMessage)Description
TRUEevaluated 2319 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
FALSEevaluated 704 times by 11 tests
Evaluated by:
  • tst_QCommandLineParser
  • tst_QFile
  • tst_QLockFile
  • tst_QProcess
  • tst_QSharedPointer
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
704-2319
1201 q->setProcessState(QProcess::Running);-
1202 emit q->started(QProcess::QPrivateSignal());-
1203 return true;
executed 2319 times by 30 tests: return true;
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • ...
2319
1204 }-
1205-
1206 q->setProcessState(QProcess::NotRunning);-
1207 setErrorAndEmit(QProcess::FailedToStart, errorMessage);-
1208#ifdef Q_OS_UNIX-
1209 // make sure the process manager removes this entry-
1210 waitForDeadChild();-
1211 findExitCode();-
1212#endif-
1213 cleanup();-
1214 return false;
executed 704 times by 11 tests: return false;
Executed by:
  • tst_QCommandLineParser
  • tst_QFile
  • tst_QLockFile
  • tst_QProcess
  • tst_QSharedPointer
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
704
1215}-
1216-
1217/*!-
1218 \internal-
1219*/-
1220void QProcessPrivate::closeWriteChannel()-
1221{-
1222#if defined QPROCESS_DEBUG-
1223 qDebug("QProcessPrivate::closeWriteChannel()");-
1224#endif-
1225 if (stdinChannel.notifier) {
stdinChannel.notifierDescription
TRUEevaluated 629 times by 6 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
  • tst_uic
FALSEnever evaluated
0-629
1226 delete stdinChannel.notifier;-
1227 stdinChannel.notifier = 0;-
1228 }
executed 629 times by 6 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
  • tst_uic
629
1229#ifdef Q_OS_WIN-
1230 // ### Find a better fix, feeding the process little by little-
1231 // instead.-
1232 flushPipeWriter();-
1233#endif-
1234 closeChannel(&stdinChannel);-
1235}
executed 629 times by 6 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
  • tst_uic
629
1236-
1237/*!-
1238 Constructs a QProcess object with the given \a parent.-
1239*/-
1240QProcess::QProcess(QObject *parent)-
1241 : QIODevice(*new QProcessPrivate, parent)-
1242{-
1243#if defined QPROCESS_DEBUG-
1244 qDebug("QProcess::QProcess(%p)", parent);-
1245#endif-
1246}
executed 2280 times by 35 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • ...
2280
1247-
1248/*!-
1249 Destructs the QProcess object, i.e., killing the process.-
1250-
1251 Note that this function will not return until the process is-
1252 terminated.-
1253*/-
1254QProcess::~QProcess()-
1255{-
1256 Q_D(QProcess);-
1257 if (d->processState != NotRunning) {
d->processState != NotRunningDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkSession
FALSEevaluated 2283 times by 39 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_QUuid
  • ...
1-2283
1258 qWarning().nospace()-
1259 << "QProcess: Destroyed while process (" << QDir::toNativeSeparators(program()) << ") is still running.";-
1260 kill();-
1261 waitForFinished();-
1262 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkSession
1
1263#ifdef Q_OS_UNIX-
1264 // make sure the process manager removes this entry-
1265 d->findExitCode();-
1266#endif-
1267 d->cleanup();-
1268}
executed 2284 times by 40 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • ...
2284
1269-
1270/*!-
1271 \obsolete-
1272 Returns the read channel mode of the QProcess. This function is-
1273 equivalent to processChannelMode()-
1274-
1275 \sa processChannelMode()-
1276*/-
1277QProcess::ProcessChannelMode QProcess::readChannelMode() const-
1278{-
1279 return processChannelMode();
executed 4 times by 1 test: return processChannelMode();
Executed by:
  • tst_QProcess
4
1280}-
1281-
1282/*!-
1283 \obsolete-
1284-
1285 Use setProcessChannelMode(\a mode) instead.-
1286-
1287 \sa setProcessChannelMode()-
1288*/-
1289void QProcess::setReadChannelMode(ProcessChannelMode mode)-
1290{-
1291 setProcessChannelMode(mode);-
1292}
executed 26 times by 4 tests: end of block
Executed by:
  • tst_QLockFile
  • tst_QProcess
  • tst_QUndoGroup
  • tst_QUndoStack
26
1293-
1294/*!-
1295 \since 4.2-
1296-
1297 Returns the channel mode of the QProcess standard output and-
1298 standard error channels.-
1299-
1300 \sa setProcessChannelMode(), ProcessChannelMode, setReadChannel()-
1301*/-
1302QProcess::ProcessChannelMode QProcess::processChannelMode() const-
1303{-
1304 Q_D(const QProcess);-
1305 return d->processChannelMode;
executed 9 times by 2 tests: return d->processChannelMode;
Executed by:
  • tst_QProcess
  • tst_qprocess - unknown status
9
1306}-
1307-
1308/*!-
1309 \since 4.2-
1310-
1311 Sets the channel mode of the QProcess standard output and standard-
1312 error channels to the \a mode specified.-
1313 This mode will be used the next time start() is called. For example:-
1314-
1315 \snippet code/src_corelib_io_qprocess.cpp 0-
1316-
1317 \sa processChannelMode(), ProcessChannelMode, setReadChannel()-
1318*/-
1319void QProcess::setProcessChannelMode(ProcessChannelMode mode)-
1320{-
1321 Q_D(QProcess);-
1322 d->processChannelMode = mode;-
1323}
executed 172 times by 14 tests: end of block
Executed by:
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QProcess
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_qmakelib
  • tst_qprocess - unknown status
172
1324-
1325/*!-
1326 \since 5.2-
1327-
1328 Returns the channel mode of the QProcess standard input channel.-
1329-
1330 \sa setInputChannelMode(), InputChannelMode-
1331*/-
1332QProcess::InputChannelMode QProcess::inputChannelMode() const-
1333{-
1334 Q_D(const QProcess);-
1335 return d->inputChannelMode;
executed 5 times by 1 test: return d->inputChannelMode;
Executed by:
  • tst_qprocess - unknown status
5
1336}-
1337-
1338/*!-
1339 \since 5.2-
1340-
1341 Sets the channel mode of the QProcess standard input-
1342 channel to the \a mode specified.-
1343 This mode will be used the next time start() is called.-
1344-
1345 \sa inputChannelMode(), InputChannelMode-
1346*/-
1347void QProcess::setInputChannelMode(InputChannelMode mode)-
1348{-
1349 Q_D(QProcess);-
1350 d->inputChannelMode = mode;-
1351}
executed 5 times by 1 test: end of block
Executed by:
  • tst_qprocess - unknown status
5
1352-
1353/*!-
1354 Returns the current read channel of the QProcess.-
1355-
1356 \sa setReadChannel()-
1357*/-
1358QProcess::ProcessChannel QProcess::readChannel() const-
1359{-
1360 Q_D(const QProcess);-
1361 return ProcessChannel(d->currentReadChannel);
executed 2523 times by 16 tests: return ProcessChannel(d->currentReadChannel);
Executed by:
  • tst_Lancelot
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QFont
  • tst_QProcess
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
2523
1362}-
1363-
1364/*!-
1365 Sets the current read channel of the QProcess to the given \a-
1366 channel. The current input channel is used by the functions-
1367 read(), readAll(), readLine(), and getChar(). It also determines-
1368 which channel triggers QProcess to emit readyRead().-
1369-
1370 \sa readChannel()-
1371*/-
1372void QProcess::setReadChannel(ProcessChannel channel)-
1373{-
1374 QIODevice::setCurrentReadChannel(int(channel));-
1375}
executed 5181 times by 18 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QFont
  • tst_QProcess
  • tst_QSharedPointer
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
5181
1376-
1377/*!-
1378 Closes the read channel \a channel. After calling this function,-
1379 QProcess will no longer receive data on the channel. Any data that-
1380 has already been received is still available for reading.-
1381-
1382 Call this function to save memory, if you are not interested in-
1383 the output of the process.-
1384-
1385 \sa closeWriteChannel(), setReadChannel()-
1386*/-
1387void QProcess::closeReadChannel(ProcessChannel channel)-
1388{-
1389 Q_D(QProcess);-
1390-
1391 if (channel == StandardOutput)
channel == StandardOutputDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QProcess
6
1392 d->stdoutChannel.closed = true;
executed 6 times by 1 test: d->stdoutChannel.closed = true;
Executed by:
  • tst_QProcess
6
1393 else-
1394 d->stderrChannel.closed = true;
executed 6 times by 1 test: d->stderrChannel.closed = true;
Executed by:
  • tst_QProcess
6
1395}-
1396-
1397/*!-
1398 Schedules the write channel of QProcess to be closed. The channel-
1399 will close once all data has been written to the process. After-
1400 calling this function, any attempts to write to the process will-
1401 fail.-
1402-
1403 Closing the write channel is necessary for programs that read-
1404 input data until the channel has been closed. For example, the-
1405 program "more" is used to display text data in a console on both-
1406 Unix and Windows. But it will not display the text data until-
1407 QProcess's write channel has been closed. Example:-
1408-
1409 \snippet code/src_corelib_io_qprocess.cpp 1-
1410-
1411 The write channel is implicitly opened when start() is called.-
1412-
1413 \sa closeReadChannel()-
1414*/-
1415void QProcess::closeWriteChannel()-
1416{-
1417 Q_D(QProcess);-
1418 d->stdinChannel.closed = true; // closing-
1419 if (d->writeBuffer.isEmpty())
d->writeBuffer.isEmpty()Description
TRUEevaluated 170 times by 6 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
  • tst_uic
FALSEevaluated 462 times by 5 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_qprocess - unknown status
170-462
1420 d->closeWriteChannel();
executed 170 times by 6 tests: d->closeWriteChannel();
Executed by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
  • tst_uic
170
1421}
executed 632 times by 8 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QSharedPointer
  • tst_QTextCodec
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
  • tst_uic
632
1422-
1423/*!-
1424 \since 4.2-
1425-
1426 Redirects the process' standard input to the file indicated by \a-
1427 fileName. When an input redirection is in place, the QProcess-
1428 object will be in read-only mode (calling write() will result in-
1429 error).-
1430-
1431 To make the process read EOF right away, pass nullDevice() here.-
1432 This is cleaner than using closeWriteChannel() before writing any-
1433 data, because it can be set up prior to starting the process.-
1434-
1435 If the file \a fileName does not exist at the moment start() is-
1436 called or is not readable, starting the process will fail.-
1437-
1438 Calling setStandardInputFile() after the process has started has no-
1439 effect.-
1440-
1441 \sa setStandardOutputFile(), setStandardErrorFile(),-
1442 setStandardOutputProcess()-
1443*/-
1444void QProcess::setStandardInputFile(const QString &fileName)-
1445{-
1446 Q_D(QProcess);-
1447 d->stdinChannel = fileName;-
1448}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QProcess
2
1449-
1450/*!-
1451 \since 4.2-
1452-
1453 Redirects the process' standard output to the file \a-
1454 fileName. When the redirection is in place, the standard output-
1455 read channel is closed: reading from it using read() will always-
1456 fail, as will readAllStandardOutput().-
1457-
1458 To discard all standard output from the process, pass nullDevice()-
1459 here. This is more efficient than simply never reading the standard-
1460 output, as no QProcess buffers are filled.-
1461-
1462 If the file \a fileName doesn't exist at the moment start() is-
1463 called, it will be created. If it cannot be created, the starting-
1464 will fail.-
1465-
1466 If the file exists and \a mode is QIODevice::Truncate, the file-
1467 will be truncated. Otherwise (if \a mode is QIODevice::Append),-
1468 the file will be appended to.-
1469-
1470 Calling setStandardOutputFile() after the process has started has-
1471 no effect.-
1472-
1473 \sa setStandardInputFile(), setStandardErrorFile(),-
1474 setStandardOutputProcess()-
1475*/-
1476void QProcess::setStandardOutputFile(const QString &fileName, OpenMode mode)-
1477{-
1478 Q_ASSERT(mode == Append || mode == Truncate);-
1479 Q_D(QProcess);-
1480-
1481 d->stdoutChannel = fileName;-
1482 d->stdoutChannel.append = mode == Append;-
1483}
executed 7 times by 1 test: end of block
Executed by:
  • tst_QProcess
7
1484-
1485/*!-
1486 \since 4.2-
1487-
1488 Redirects the process' standard error to the file \a-
1489 fileName. When the redirection is in place, the standard error-
1490 read channel is closed: reading from it using read() will always-
1491 fail, as will readAllStandardError(). The file will be appended to-
1492 if \a mode is Append, otherwise, it will be truncated.-
1493-
1494 See setStandardOutputFile() for more information on how the file-
1495 is opened.-
1496-
1497 Note: if setProcessChannelMode() was called with an argument of-
1498 QProcess::MergedChannels, this function has no effect.-
1499-
1500 \sa setStandardInputFile(), setStandardOutputFile(),-
1501 setStandardOutputProcess()-
1502*/-
1503void QProcess::setStandardErrorFile(const QString &fileName, OpenMode mode)-
1504{-
1505 Q_ASSERT(mode == Append || mode == Truncate);-
1506 Q_D(QProcess);-
1507-
1508 d->stderrChannel = fileName;-
1509 d->stderrChannel.append = mode == Append;-
1510}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QProcess
3
1511-
1512/*!-
1513 \since 4.2-
1514-
1515 Pipes the standard output stream of this process to the \a-
1516 destination process' standard input.-
1517-
1518 The following shell command:-
1519 \snippet code/src_corelib_io_qprocess.cpp 2-
1520-
1521 Can be accomplished with QProcess with the following code:-
1522 \snippet code/src_corelib_io_qprocess.cpp 3-
1523*/-
1524void QProcess::setStandardOutputProcess(QProcess *destination)-
1525{-
1526 QProcessPrivate *dfrom = d_func();-
1527 QProcessPrivate *dto = destination->d_func();-
1528 dfrom->stdoutChannel.pipeTo(dto);-
1529 dto->stdinChannel.pipeFrom(dfrom);-
1530}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QProcess
3
1531-
1532#if defined(Q_OS_WIN)-
1533-
1534/*!-
1535 \since 4.7-
1536-
1537 Returns the additional native command line arguments for the program.-
1538-
1539 \note This function is available only on the Windows platform.-
1540-
1541 \sa setNativeArguments()-
1542*/-
1543QString QProcess::nativeArguments() const-
1544{-
1545 Q_D(const QProcess);-
1546 return d->nativeArguments;-
1547}-
1548-
1549/*!-
1550 \since 4.7-
1551 \overload-
1552-
1553 Sets additional native command line \a arguments for the program.-
1554-
1555 On operating systems where the system API for passing command line-
1556 \a arguments to a subprocess natively uses a single string, one can-
1557 conceive command lines which cannot be passed via QProcess's portable-
1558 list-based API. In such cases this function must be used to set a-
1559 string which is \e appended to the string composed from the usual-
1560 argument list, with a delimiting space.-
1561-
1562 \note This function is available only on the Windows platform.-
1563-
1564 \sa nativeArguments()-
1565*/-
1566void QProcess::setNativeArguments(const QString &arguments)-
1567{-
1568 Q_D(QProcess);-
1569 d->nativeArguments = arguments;-
1570}-
1571-
1572/*!-
1573 \since 5.7-
1574-
1575 Returns a previously set \c CreateProcess modifier function.-
1576-
1577 \note This function is available only on the Windows platform.-
1578-
1579 \sa setCreateProcessArgumentsModifier()-
1580 \sa QProcess::CreateProcessArgumentModifier-
1581*/-
1582QProcess::CreateProcessArgumentModifier QProcess::createProcessArgumentsModifier() const-
1583{-
1584 Q_D(const QProcess);-
1585 return d->modifyCreateProcessArgs;-
1586}-
1587-
1588/*!-
1589 \since 5.7-
1590-
1591 Sets the \a modifier for the \c CreateProcess Win32 API call.-
1592 Pass \c QProcess::CreateProcessArgumentModifier() to remove a previously set one.-
1593-
1594 \note This function is available only on the Windows platform and requires-
1595 C++11.-
1596-
1597 \sa QProcess::CreateProcessArgumentModifier-
1598*/-
1599void QProcess::setCreateProcessArgumentsModifier(CreateProcessArgumentModifier modifier)-
1600{-
1601 Q_D(QProcess);-
1602 d->modifyCreateProcessArgs = modifier;-
1603}-
1604-
1605#endif-
1606-
1607/*!-
1608 If QProcess has been assigned a working directory, this function returns-
1609 the working directory that the QProcess will enter before the program has-
1610 started. Otherwise, (i.e., no directory has been assigned,) an empty-
1611 string is returned, and QProcess will use the application's current-
1612 working directory instead.-
1613-
1614 \sa setWorkingDirectory()-
1615*/-
1616QString QProcess::workingDirectory() const-
1617{-
1618 Q_D(const QProcess);-
1619 return d->workingDirectory;
executed 1 time by 1 test: return d->workingDirectory;
Executed by:
  • tst_QProcess
1
1620}-
1621-
1622/*!-
1623 Sets the working directory to \a dir. QProcess will start the-
1624 process in this directory. The default behavior is to start the-
1625 process in the working directory of the calling process.-
1626-
1627 \note On QNX, this may cause all application threads to-
1628 temporarily freeze.-
1629-
1630 \sa workingDirectory(), start()-
1631*/-
1632void QProcess::setWorkingDirectory(const QString &dir)-
1633{-
1634 Q_D(QProcess);-
1635 d->workingDirectory = dir;-
1636}
executed 517 times by 4 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qmakelib
517
1637-
1638-
1639/*!-
1640 \deprecated-
1641 Use processId() instead.-
1642-
1643 Returns the native process identifier for the running process, if-
1644 available. If no process is currently running, \c 0 is returned.-
1645-
1646 \note Unlike \l processId(), pid() returns an integer on Unix and a pointer on Windows.-
1647-
1648 \sa Q_PID, processId()-
1649*/-
1650Q_PID QProcess::pid() const // ### Qt 6 remove or rename this method to processInformation()-
1651{-
1652 Q_D(const QProcess);-
1653 return d->pid;
executed 1 time by 1 test: return d->pid;
Executed by:
  • tst_QProcess
1
1654}-
1655-
1656/*!-
1657 \since 5.3-
1658-
1659 Returns the native process identifier for the running process, if-
1660 available. If no process is currently running, \c 0 is returned.-
1661 */-
1662qint64 QProcess::processId() const-
1663{-
1664 Q_D(const QProcess);-
1665#ifdef Q_OS_WIN-
1666 return d->pid ? d->pid->dwProcessId : 0;-
1667#else-
1668 return d->pid;
executed 15 times by 2 tests: return d->pid;
Executed by:
  • tst_QProcess
  • tst_qmessagehandler
15
1669#endif-
1670}-
1671-
1672/*! \reimp-
1673-
1674 This function operates on the current read channel.-
1675-
1676 \sa readChannel(), setReadChannel()-
1677*/-
1678bool QProcess::canReadLine() const-
1679{-
1680 return QIODevice::canReadLine();
executed 1 time by 1 test: return QIODevice::canReadLine();
Executed by:
  • tst_QProcess
1
1681}-
1682-
1683/*!-
1684 Closes all communication with the process and kills it. After calling this-
1685 function, QProcess will no longer emit readyRead(), and data can no-
1686 longer be read or written.-
1687*/-
1688void QProcess::close()-
1689{-
1690 Q_D(QProcess);-
1691 emit aboutToClose();-
1692 while (waitForBytesWritten(-1))
waitForBytesWritten(-1)Description
TRUEnever evaluated
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QProcess
0-5
1693 ;
never executed: ;
0
1694 kill();-
1695 waitForFinished(-1);-
1696 d->setWriteChannelCount(0);-
1697 QIODevice::close();-
1698}
executed 5 times by 5 tests: end of block
Executed by:
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QProcess
5
1699-
1700/*! \reimp-
1701-
1702 Returns \c true if the process is not running, and no more data is available-
1703 for reading; otherwise returns \c false.-
1704*/-
1705bool QProcess::atEnd() const-
1706{-
1707 return QIODevice::atEnd();
executed 61 times by 3 tests: return QIODevice::atEnd();
Executed by:
  • tst_Lancelot
  • tst_QNetworkReply
  • tst_QProcess
61
1708}-
1709-
1710/*! \reimp-
1711*/-
1712bool QProcess::isSequential() const-
1713{-
1714 return true;
executed 2056 times by 20 tests: return true;
Executed by:
  • tst_Lancelot
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QFont
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
2056
1715}-
1716-
1717/*! \reimp-
1718*/-
1719qint64 QProcess::bytesAvailable() const-
1720{-
1721 return QIODevice::bytesAvailable();
executed 872 times by 3 tests: return QIODevice::bytesAvailable();
Executed by:
  • tst_Lancelot
  • tst_QNetworkReply
  • tst_QProcess
872
1722}-
1723-
1724/*! \reimp-
1725*/-
1726qint64 QProcess::bytesToWrite() const-
1727{-
1728 qint64 size = QIODevice::bytesToWrite();-
1729#ifdef Q_OS_WIN-
1730 size += d_func()->pipeWriterBytesToWrite();-
1731#endif-
1732 return size;
executed 3728 times by 2 tests: return size;
Executed by:
  • tst_QProcess
  • tst_qdbusxml2cpp
3728
1733}-
1734-
1735/*!-
1736 Returns the type of error that occurred last.-
1737-
1738 \sa state()-
1739*/-
1740QProcess::ProcessError QProcess::error() const-
1741{-
1742 Q_D(const QProcess);-
1743 return d->processError;
executed 774 times by 4 tests: return d->processError;
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QProcess
  • tst_QSharedMemory
774
1744}-
1745-
1746/*!-
1747 Returns the current state of the process.-
1748-
1749 \sa stateChanged(), error()-
1750*/-
1751QProcess::ProcessState QProcess::state() const-
1752{-
1753 Q_D(const QProcess);-
1754 return d->processState;
executed 94 times by 5 tests: return d->processState;
Executed by:
  • tst_QApplication
  • tst_QFile
  • tst_QProcess
  • tst_QSharedPointer
  • tst_QSystemSemaphore
94
1755}-
1756-
1757/*!-
1758 \deprecated-
1759 Sets the environment that QProcess will pass to the child process.-
1760 The parameter \a environment is a list of key=value pairs.-
1761-
1762 For example, the following code adds the environment variable \c{TMPDIR}:-
1763-
1764 \snippet qprocess-environment/main.cpp 0-
1765-
1766 \note This function is less efficient than the setProcessEnvironment()-
1767 function.-
1768-
1769 \sa environment(), setProcessEnvironment(), systemEnvironment()-
1770*/-
1771void QProcess::setEnvironment(const QStringList &environment)-
1772{-
1773 setProcessEnvironment(QProcessEnvironmentPrivate::fromList(environment));-
1774}
executed 137 times by 4 tests: end of block
Executed by:
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qmake
  • tst_qmessagehandler
137
1775-
1776/*!-
1777 \deprecated-
1778 Returns the environment that QProcess will pass to its child-
1779 process, or an empty QStringList if no environment has been set-
1780 using setEnvironment(). If no environment has been set, the-
1781 environment of the calling process will be used.-
1782-
1783 \sa processEnvironment(), setEnvironment(), systemEnvironment()-
1784*/-
1785QStringList QProcess::environment() const-
1786{-
1787 Q_D(const QProcess);-
1788 return d->environment.toStringList();
executed 1 time by 1 test: return d->environment.toStringList();
Executed by:
  • tst_QProcess
1
1789}-
1790-
1791/*!-
1792 \since 4.6-
1793 Sets the \a environment that QProcess will pass to the child process.-
1794-
1795 For example, the following code adds the environment variable \c{TMPDIR}:-
1796-
1797 \snippet qprocess-environment/main.cpp 1-
1798-
1799 Note how, on Windows, environment variable names are case-insensitive.-
1800-
1801 \sa processEnvironment(), QProcessEnvironment::systemEnvironment(), setEnvironment()-
1802*/-
1803void QProcess::setProcessEnvironment(const QProcessEnvironment &environment)-
1804{-
1805 Q_D(QProcess);-
1806 d->environment = environment;-
1807}
executed 934 times by 6 tests: end of block
Executed by:
  • tst_QProcess
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
934
1808-
1809/*!-
1810 \since 4.6-
1811 Returns the environment that QProcess will pass to its child-
1812 process, or an empty object if no environment has been set using-
1813 setEnvironment() or setProcessEnvironment(). If no environment has-
1814 been set, the environment of the calling process will be used.-
1815-
1816 \sa setProcessEnvironment(), setEnvironment(), QProcessEnvironment::isEmpty()-
1817*/-
1818QProcessEnvironment QProcess::processEnvironment() const-
1819{-
1820 Q_D(const QProcess);-
1821 return d->environment;
never executed: return d->environment;
0
1822}-
1823-
1824/*!-
1825 Blocks until the process has started and the started() signal has-
1826 been emitted, or until \a msecs milliseconds have passed.-
1827-
1828 Returns \c true if the process was started successfully; otherwise-
1829 returns \c false (if the operation timed out or if an error-
1830 occurred).-
1831-
1832 This function can operate without an event loop. It is-
1833 useful when writing non-GUI applications and when performing-
1834 I/O operations in a non-GUI thread.-
1835-
1836 \warning Calling this function from the main (GUI) thread-
1837 might cause your user interface to freeze.-
1838-
1839 If msecs is -1, this function will not time out.-
1840-
1841 \note On some UNIX operating systems, this function may return true but-
1842 the process may later report a QProcess::FailedToStart error.-
1843-
1844 \sa started(), waitForReadyRead(), waitForBytesWritten(), waitForFinished()-
1845*/-
1846bool QProcess::waitForStarted(int msecs)-
1847{-
1848 Q_D(QProcess);-
1849 if (d->processState == QProcess::Starting)
d->processStat...cess::StartingDescription
TRUEevaluated 2796 times by 37 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • ...
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QProcess
4-2796
1850 return d->waitForStarted(msecs);
executed 2796 times by 37 tests: return d->waitForStarted(msecs);
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • ...
2796
1851-
1852 return d->processState == QProcess::Running;
executed 4 times by 1 test: return d->processState == QProcess::Running;
Executed by:
  • tst_QProcess
4
1853}-
1854-
1855/*! \reimp-
1856*/-
1857bool QProcess::waitForReadyRead(int msecs)-
1858{-
1859 Q_D(QProcess);-
1860-
1861 if (d->processState == QProcess::NotRunning)
d->processStat...ss::NotRunningDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 709 times by 9 tests
Evaluated by:
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QTextStream
1-709
1862 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QProcess
1
1863 if (d->currentReadChannel == QProcess::StandardOutput && d->stdoutChannel.closed)
d->currentRead...StandardOutputDescription
TRUEevaluated 681 times by 8 tests
Evaluated by:
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
FALSEevaluated 28 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_QTextStream
d->stdoutChannel.closedDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 676 times by 8 tests
Evaluated by:
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
5-681
1864 return false;
executed 5 times by 1 test: return false;
Executed by:
  • tst_QProcess
5
1865 if (d->currentReadChannel == QProcess::StandardError && d->stderrChannel.closed)
d->currentRead...:StandardErrorDescription
TRUEevaluated 28 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_QTextStream
FALSEevaluated 676 times by 8 tests
Evaluated by:
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
d->stderrChannel.closedDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 23 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_QTextStream
5-676
1866 return false;
executed 5 times by 1 test: return false;
Executed by:
  • tst_QProcess
5
1867 return d->waitForReadyRead(msecs);
executed 699 times by 9 tests: return d->waitForReadyRead(msecs);
Executed by:
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QTextStream
699
1868}-
1869-
1870/*! \reimp-
1871*/-
1872bool QProcess::waitForBytesWritten(int msecs)-
1873{-
1874 Q_D(QProcess);-
1875 if (d->processState == QProcess::NotRunning)
d->processStat...ss::NotRunningDescription
TRUEevaluated 4 times by 4 tests
Evaluated by:
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
FALSEevaluated 3262 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_qdbusxml2cpp
4-3262
1876 return false;
executed 4 times by 4 tests: return false;
Executed by:
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
4
1877 if (d->processState == QProcess::Starting) {
d->processStat...cess::StartingDescription
TRUEevaluated 535 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 2727 times by 2 tests
Evaluated by:
  • tst_QProcess
  • tst_qdbusxml2cpp
535-2727
1878 QElapsedTimer stopWatch;-
1879 stopWatch.start();-
1880 bool started = waitForStarted(msecs);-
1881 if (!started)
!startedDescription
TRUEevaluated 100 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 435 times by 1 test
Evaluated by:
  • tst_QProcess
100-435
1882 return false;
executed 100 times by 1 test: return false;
Executed by:
  • tst_QProcess
100
1883 msecs = qt_subtract_from_timeout(msecs, stopWatch.elapsed());-
1884 }
executed 435 times by 1 test: end of block
Executed by:
  • tst_QProcess
435
1885-
1886 return d->waitForBytesWritten(msecs);
executed 3162 times by 2 tests: return d->waitForBytesWritten(msecs);
Executed by:
  • tst_QProcess
  • tst_qdbusxml2cpp
3162
1887}-
1888-
1889/*!-
1890 Blocks until the process has finished and the finished() signal-
1891 has been emitted, or until \a msecs milliseconds have passed.-
1892-
1893 Returns \c true if the process finished; otherwise returns \c false (if-
1894 the operation timed out, if an error occurred, or if this QProcess-
1895 is already finished).-
1896-
1897 This function can operate without an event loop. It is-
1898 useful when writing non-GUI applications and when performing-
1899 I/O operations in a non-GUI thread.-
1900-
1901 \warning Calling this function from the main (GUI) thread-
1902 might cause your user interface to freeze.-
1903-
1904 If msecs is -1, this function will not time out.-
1905-
1906 \sa finished(), waitForStarted(), waitForReadyRead(), waitForBytesWritten()-
1907*/-
1908bool QProcess::waitForFinished(int msecs)-
1909{-
1910 Q_D(QProcess);-
1911 if (d->processState == QProcess::NotRunning)
d->processStat...ss::NotRunningDescription
TRUEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QProcess
FALSEevaluated 2373 times by 35 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUndoGroup
  • tst_QUndoStack
  • ...
5-2373
1912 return false;
executed 5 times by 5 tests: return false;
Executed by:
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QProcess
5
1913 if (d->processState == QProcess::Starting) {
d->processStat...cess::StartingDescription
TRUEevaluated 587 times by 15 tests
Evaluated by:
  • tst_Lancelot
  • tst_QCommandLineParser
  • tst_QDir
  • tst_QLockFile
  • tst_QProcess
  • tst_QSharedMemory
  • tst_QSystemSemaphore
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_QUuid
  • tst_qdbuscpp2xml
  • tst_qmakelib
  • tst_rcc
FALSEevaluated 1786 times by 22 tests
Evaluated by:
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_Selftests
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_uic
587-1786
1914 QElapsedTimer stopWatch;-
1915 stopWatch.start();-
1916 bool started = waitForStarted(msecs);-
1917 if (!started)
!startedDescription
TRUEevaluated 117 times by 7 tests
Evaluated by:
  • tst_QCommandLineParser
  • tst_QLockFile
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUndoGroup
  • tst_QUndoStack
FALSEevaluated 470 times by 9 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDir
  • tst_QProcess
  • tst_QSharedMemory
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_qdbuscpp2xml
  • tst_qmakelib
  • tst_rcc
117-470
1918 return false;
executed 117 times by 7 tests: return false;
Executed by:
  • tst_QCommandLineParser
  • tst_QLockFile
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUndoGroup
  • tst_QUndoStack
117
1919 msecs = qt_subtract_from_timeout(msecs, stopWatch.elapsed());-
1920 }
executed 470 times by 9 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QDir
  • tst_QProcess
  • tst_QSharedMemory
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_qdbuscpp2xml
  • tst_qmakelib
  • tst_rcc
470
1921-
1922 return d->waitForFinished(msecs);
executed 2256 times by 29 tests: return d->waitForFinished(msecs);
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFont
  • tst_QIcon
  • tst_QMimeDatabase
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • ...
2256
1923}-
1924-
1925/*!-
1926 Sets the current state of the QProcess to the \a state specified.-
1927-
1928 \sa state()-
1929*/-
1930void QProcess::setProcessState(ProcessState state)-
1931{-
1932 Q_D(QProcess);-
1933 if (d->processState == state)
d->processState == stateDescription
TRUEevaluated 2988 times by 40 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • ...
FALSEevaluated 8365 times by 39 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
2988-8365
1934 return;
executed 2988 times by 40 tests: return;
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • ...
2988
1935 d->processState = state;-
1936 emit stateChanged(state, QPrivateSignal());-
1937}
executed 8365 times by 39 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
8365
1938-
1939/*!-
1940 This function is called in the child process context just before the-
1941 program is executed on Unix or \macos (i.e., after \c fork(), but before-
1942 \c execve()). Reimplement this function to do last minute initialization-
1943 of the child process. Example:-
1944-
1945 \snippet code/src_corelib_io_qprocess.cpp 4-
1946-
1947 You cannot exit the process (by calling exit(), for instance) from-
1948 this function. If you need to stop the program before it starts-
1949 execution, your workaround is to emit finished() and then call-
1950 exit().-
1951-
1952 \warning This function is called by QProcess on Unix and \macos-
1953 only. On Windows and QNX, it is not called.-
1954*/-
1955void QProcess::setupChildProcess()-
1956{-
1957}-
1958-
1959/*! \reimp-
1960*/-
1961qint64 QProcess::readData(char *data, qint64 maxlen)-
1962{-
1963 Q_D(QProcess);-
1964 Q_UNUSED(data);-
1965 if (!maxlen)
!maxlenDescription
TRUEevaluated 258 times by 6 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_rcc
FALSEevaluated 4081 times by 18 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QFont
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
258-4081
1966 return 0;
executed 258 times by 6 tests: return 0;
Executed by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_rcc
258
1967 if (d->processState == QProcess::NotRunning)
d->processStat...ss::NotRunningDescription
TRUEevaluated 3483 times by 16 tests
Evaluated by:
  • tst_Lancelot
  • tst_QFont
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
FALSEevaluated 598 times by 5 tests
Evaluated by:
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
598-3483
1968 return -1; // EOF
executed 3483 times by 16 tests: return -1;
Executed by:
  • tst_Lancelot
  • tst_QFont
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
3483
1969 return 0;
executed 598 times by 5 tests: return 0;
Executed by:
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
598
1970}-
1971-
1972/*! \reimp-
1973*/-
1974qint64 QProcess::writeData(const char *data, qint64 len)-
1975{-
1976 Q_D(QProcess);-
1977-
1978#if defined(Q_OS_WINCE)-
1979 Q_UNUSED(data);-
1980 Q_UNUSED(len);-
1981 d->setErrorAndEmit(QProcess::WriteError);-
1982 return -1;-
1983#endif-
1984-
1985 if (d->stdinChannel.closed) {
d->stdinChannel.closedDescription
TRUEnever evaluated
FALSEevaluated 1167 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QTextCodec
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
0-1167
1986#if defined QPROCESS_DEBUG-
1987 qDebug("QProcess::writeData(%p \"%s\", %lld) == 0 (write channel closing)",-
1988 data, qt_prettyDebug(data, len, 16).constData(), len);-
1989#endif-
1990 return 0;
never executed: return 0;
0
1991 }-
1992-
1993#if defined(Q_OS_WIN)-
1994 if (!d->stdinWriteTrigger) {-
1995 d->stdinWriteTrigger = new QTimer;-
1996 d->stdinWriteTrigger->setSingleShot(true);-
1997 QObjectPrivate::connect(d->stdinWriteTrigger, &QTimer::timeout,-
1998 d, &QProcessPrivate::_q_canWrite);-
1999 }-
2000#endif-
2001-
2002 d->writeBuffer.append(data, len);-
2003#ifdef Q_OS_WIN-
2004 if (!d->stdinWriteTrigger->isActive())-
2005 d->stdinWriteTrigger->start();-
2006#else-
2007 if (d->stdinChannel.notifier)
d->stdinChannel.notifierDescription
TRUEevaluated 1167 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QTextCodec
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
FALSEnever evaluated
0-1167
2008 d->stdinChannel.notifier->setEnabled(true);
executed 1167 times by 7 tests: d->stdinChannel.notifier->setEnabled(true);
Executed by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QTextCodec
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
1167
2009#endif-
2010#if defined QPROCESS_DEBUG-
2011 qDebug("QProcess::writeData(%p \"%s\", %lld) == %lld (written to buffer)",-
2012 data, qt_prettyDebug(data, len, 16).constData(), len, len);-
2013#endif-
2014 return len;
executed 1167 times by 7 tests: return len;
Executed by:
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QTextCodec
  • tst_QTextStream
  • tst_qdbusxml2cpp
  • tst_qprocess - unknown status
1167
2015}-
2016-
2017/*!-
2018 Regardless of the current read channel, this function returns all-
2019 data available from the standard output of the process as a-
2020 QByteArray.-
2021-
2022 \sa readyReadStandardOutput(), readAllStandardError(), readChannel(), setReadChannel()-
2023*/-
2024QByteArray QProcess::readAllStandardOutput()-
2025{-
2026 ProcessChannel tmp = readChannel();-
2027 setReadChannel(StandardOutput);-
2028 QByteArray data = readAll();-
2029 setReadChannel(tmp);-
2030 return data;
executed 638 times by 11 tests: return data;
Executed by:
  • tst_Lancelot
  • tst_QFont
  • tst_QProcess
  • tst_QSharedPointer
  • tst_QUuid
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qmakelib
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
638
2031}-
2032-
2033/*!-
2034 Regardless of the current read channel, this function returns all-
2035 data available from the standard error of the process as a-
2036 QByteArray.-
2037-
2038 \sa readyReadStandardError(), readAllStandardOutput(), readChannel(), setReadChannel()-
2039*/-
2040QByteArray QProcess::readAllStandardError()-
2041{-
2042 ProcessChannel tmp = readChannel();-
2043 setReadChannel(StandardError);-
2044 QByteArray data = readAll();-
2045 setReadChannel(tmp);-
2046 return data;
executed 1882 times by 13 tests: return data;
Executed by:
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QProcess
  • tst_QSharedPointer
  • tst_Selftests
  • tst_qdbuscpp2xml
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_qmessagehandler
  • tst_qprocess - unknown status
  • tst_rcc
  • tst_uic
1882
2047}-
2048-
2049/*!-
2050 Starts the given \a program in a new process, passing the command line-
2051 arguments in \a arguments.-
2052-
2053 The QProcess object will immediately enter the Starting state. If the-
2054 process starts successfully, QProcess will emit started(); otherwise,-
2055 errorOccurred() will be emitted.-
2056-
2057 \note Processes are started asynchronously, which means the started()-
2058 and errorOccurred() signals may be delayed. Call waitForStarted() to make-
2059 sure the process has started (or has failed to start) and those signals-
2060 have been emitted.-
2061-
2062 \note No further splitting of the arguments is performed.-
2063-
2064 \b{Windows:} The arguments are quoted and joined into a command line-
2065 that is compatible with the \c CommandLineToArgvW() Windows function.-
2066 For programs that have different command line quoting requirements,-
2067 you need to use setNativeArguments(). One notable program that does-
2068 not follow the \c CommandLineToArgvW() rules is cmd.exe and, by-
2069 consequence, all batch scripts.-
2070-
2071 The OpenMode is set to \a mode.-
2072-
2073 If the QProcess object is already running a process, a warning may be-
2074 printed at the console, and the existing process will continue running-
2075 unaffected.-
2076-
2077 \sa processId(), started(), waitForStarted(), setNativeArguments()-
2078*/-
2079void QProcess::start(const QString &program, const QStringList &arguments, OpenMode mode)-
2080{-
2081 Q_D(QProcess);-
2082 if (d->processState != NotRunning) {
d->processState != NotRunningDescription
TRUEnever evaluated
FALSEevaluated 3022 times by 39 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
0-3022
2083 qWarning("QProcess::start: Process is already running");-
2084 return;
never executed: return;
0
2085 }-
2086 if (program.isEmpty()) {
program.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 3021 times by 39 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
1-3021
2087 d->setErrorAndEmit(QProcess::FailedToStart, tr("No program defined"));-
2088 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QProcess
1
2089 }-
2090-
2091 d->program = program;-
2092 d->arguments = arguments;-
2093-
2094 d->start(mode);-
2095}
executed 3021 times by 39 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
3021
2096-
2097/*!-
2098 \since 5.1-
2099 \overload-
2100-
2101 Starts the program set by setProgram() with arguments set by setArguments().-
2102 The OpenMode is set to \a mode.-
2103-
2104 \sa open(), setProgram(), setArguments()-
2105 */-
2106void QProcess::start(OpenMode mode)-
2107{-
2108 Q_D(QProcess);-
2109 if (d->processState != NotRunning) {
d->processState != NotRunningDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QProcess
0-2
2110 qWarning("QProcess::start: Process is already running");-
2111 return;
never executed: return;
0
2112 }-
2113 if (d->program.isEmpty()) {
d->program.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QProcess
1
2114 d->setErrorAndEmit(QProcess::FailedToStart, tr("No program defined"));-
2115 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QProcess
1
2116 }-
2117-
2118 d->start(mode);-
2119}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QProcess
1
2120-
2121/*!-
2122 Starts the program set by setProgram() with arguments set by setArguments().-
2123 The OpenMode is set to \a mode.-
2124-
2125 This method is an alias for start(), and exists only to fully implement-
2126 the interface defined by QIODevice.-
2127-
2128 \sa start(), setProgram(), setArguments()-
2129*/-
2130bool QProcess::open(OpenMode mode)-
2131{-
2132 Q_D(QProcess);-
2133 if (d->processState != NotRunning) {
d->processState != NotRunningDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QProcess
0-2
2134 qWarning("QProcess::start: Process is already running");-
2135 return false;
never executed: return false;
0
2136 }-
2137 if (d->program.isEmpty()) {
d->program.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QProcess
1
2138 qWarning("QProcess::start: program not set");-
2139 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QProcess
1
2140 }-
2141-
2142 d->start(mode);-
2143 return true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_QProcess
1
2144}-
2145-
2146void QProcessPrivate::start(QIODevice::OpenMode mode)-
2147{-
2148 Q_Q(QProcess);-
2149#if defined QPROCESS_DEBUG-
2150 qDebug() << "QProcess::start(" << program << ',' << arguments << ',' << mode << ')';-
2151#endif-
2152-
2153 if (stdinChannel.type != QProcessPrivate::Channel::Normal)
stdinChannel.t...hannel::NormalDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 3018 times by 39 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
5-3018
2154 mode &= ~QIODevice::WriteOnly; // not open for writing
executed 5 times by 1 test: mode &= ~QIODevice::WriteOnly;
Executed by:
  • tst_QProcess
5
2155 if (stdoutChannel.type != QProcessPrivate::Channel::Normal &&
stdoutChannel....hannel::NormalDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 3014 times by 39 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
9-3014
2156 (stderrChannel.type != QProcessPrivate::Channel::Normal ||
stderrChannel....hannel::NormalDescription
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QProcess
0-9
2157 processChannelMode == QProcess::MergedChannels))
processChannel...MergedChannelsDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QProcess
3-6
2158 mode &= ~QIODevice::ReadOnly; // not open for reading
executed 3 times by 1 test: mode &= ~QIODevice::ReadOnly;
Executed by:
  • tst_QProcess
3
2159 if (mode == 0)
mode == 0Description
TRUEnever evaluated
FALSEevaluated 3023 times by 39 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
0-3023
2160 mode = QIODevice::Unbuffered;
never executed: mode = QIODevice::Unbuffered;
0
2161#ifndef Q_OS_WINCE-
2162 if ((mode & QIODevice::ReadOnly) == 0) {
(mode & QIODev...ReadOnly) == 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 3019 times by 39 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
4-3019
2163 if (stdoutChannel.type == QProcessPrivate::Channel::Normal)
stdoutChannel....hannel::NormalDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QProcess
1-3
2164 q->setStandardOutputFile(q->nullDevice());
executed 1 time by 1 test: q->setStandardOutputFile(q->nullDevice());
Executed by:
  • tst_QProcess
1
2165 if (stderrChannel.type == QProcessPrivate::Channel::Normal
stderrChannel....hannel::NormalDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEnever evaluated
0-4
2166 && processChannelMode != QProcess::MergedChannels)
processChannel...MergedChannelsDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QProcess
1-3
2167 q->setStandardErrorFile(q->nullDevice());
executed 1 time by 1 test: q->setStandardErrorFile(q->nullDevice());
Executed by:
  • tst_QProcess
1
2168 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QProcess
4
2169#endif-
2170-
2171 q->QIODevice::open(mode);-
2172-
2173 if (q->isReadable() && processChannelMode != QProcess::MergedChannels)
q->isReadable()Description
TRUEevaluated 3019 times by 39 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QProcess
processChannel...MergedChannelsDescription
TRUEevaluated 3004 times by 38 tests
Evaluated by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • ...
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QMimeDatabase
  • tst_QProcess
4-3019
2174 setReadChannelCount(2);
executed 3004 times by 38 tests: setReadChannelCount(2);
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QTextStream
  • ...
3004
2175-
2176 stdinChannel.closed = false;-
2177 stdoutChannel.closed = false;-
2178 stderrChannel.closed = false;-
2179-
2180 exitCode = 0;-
2181 exitStatus = QProcess::NormalExit;-
2182 processError = QProcess::UnknownError;-
2183 errorString.clear();-
2184 startProcess();-
2185}
executed 3023 times by 39 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFont
  • tst_QIcon
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedMemory
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
3023
2186-
2187-
2188static QStringList parseCombinedArgString(const QString &program)-
2189{-
2190 QStringList args;-
2191 QString tmp;-
2192 int quoteCount = 0;-
2193 bool inQuote = false;-
2194-
2195 // handle quoting. tokens can be surrounded by double quotes-
2196 // "hello world". three consecutive double quotes represent-
2197 // the quote character itself.-
2198 for (int i = 0; i < program.size(); ++i) {
i < program.size()Description
TRUEevaluated 60345 times by 16 tests
Evaluated by:
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_QUuid
  • tst_qmessagehandler
  • tst_qprocess - unknown status
FALSEevaluated 1327 times by 16 tests
Evaluated by:
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_QUuid
  • tst_qmessagehandler
  • tst_qprocess - unknown status
1327-60345
2199 if (program.at(i) == QLatin1Char('"')) {
program.at(i) ...atin1Char('"')Description
TRUEevaluated 372 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 59973 times by 16 tests
Evaluated by:
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_QUuid
  • tst_qmessagehandler
  • tst_qprocess - unknown status
372-59973
2200 ++quoteCount;-
2201 if (quoteCount == 3) {
quoteCount == 3Description
TRUEevaluated 84 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 288 times by 1 test
Evaluated by:
  • tst_QProcess
84-288
2202 // third consecutive quote-
2203 quoteCount = 0;-
2204 tmp += program.at(i);-
2205 }
executed 84 times by 1 test: end of block
Executed by:
  • tst_QProcess
84
2206 continue;
executed 372 times by 1 test: continue;
Executed by:
  • tst_QProcess
372
2207 }-
2208 if (quoteCount) {
quoteCountDescription
TRUEevaluated 99 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 59874 times by 16 tests
Evaluated by:
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_QUuid
  • tst_qmessagehandler
  • tst_qprocess - unknown status
99-59874
2209 if (quoteCount == 1)
quoteCount == 1Description
TRUEevaluated 93 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QProcess
6-93
2210 inQuote = !inQuote;
executed 93 times by 1 test: inQuote = !inQuote;
Executed by:
  • tst_QProcess
93
2211 quoteCount = 0;-
2212 }
executed 99 times by 1 test: end of block
Executed by:
  • tst_QProcess
99
2213 if (!inQuote && program.at(i).isSpace()) {
!inQuoteDescription
TRUEevaluated 59079 times by 16 tests
Evaluated by:
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_QUuid
  • tst_qmessagehandler
  • tst_qprocess - unknown status
FALSEevaluated 894 times by 1 test
Evaluated by:
  • tst_QProcess
program.at(i).isSpace()Description
TRUEevaluated 330 times by 4 tests
Evaluated by:
  • tst_QProcess
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
FALSEevaluated 58749 times by 16 tests
Evaluated by:
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_QUuid
  • tst_qmessagehandler
  • tst_qprocess - unknown status
330-59079
2214 if (!tmp.isEmpty()) {
!tmp.isEmpty()Description
TRUEevaluated 317 times by 4 tests
Evaluated by:
  • tst_QProcess
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
FALSEevaluated 13 times by 1 test
Evaluated by:
  • tst_QProcess
13-317
2215 args += tmp;-
2216 tmp.clear();-
2217 }
executed 317 times by 4 tests: end of block
Executed by:
  • tst_QProcess
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
317
2218 } else {
executed 330 times by 4 tests: end of block
Executed by:
  • tst_QProcess
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
330
2219 tmp += program.at(i);-
2220 }
executed 59643 times by 16 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_QUuid
  • tst_qmessagehandler
  • tst_qprocess - unknown status
59643
2221 }-
2222 if (!tmp.isEmpty())
!tmp.isEmpty()Description
TRUEevaluated 1317 times by 16 tests
Evaluated by:
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_QUuid
  • tst_qmessagehandler
  • tst_qprocess - unknown status
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QProcess
10-1317
2223 args += tmp;
executed 1317 times by 16 tests: args += tmp;
Executed by:
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_QUuid
  • tst_qmessagehandler
  • tst_qprocess - unknown status
1317
2224-
2225 return args;
executed 1327 times by 16 tests: return args;
Executed by:
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_QUuid
  • tst_qmessagehandler
  • tst_qprocess - unknown status
1327
2226}-
2227-
2228/*!-
2229 \overload-
2230-
2231 Starts the command \a command in a new process.-
2232 The OpenMode is set to \a mode.-
2233-
2234 \a command is a single string of text containing both the program name-
2235 and its arguments. The arguments are separated by one or more spaces.-
2236 For example:-
2237-
2238 \snippet code/src_corelib_io_qprocess.cpp 5-
2239-
2240 Arguments containing spaces must be quoted to be correctly supplied to-
2241 the new process. For example:-
2242-
2243 \snippet code/src_corelib_io_qprocess.cpp 6-
2244-
2245 Literal quotes in the \a command string are represented by triple quotes.-
2246 For example:-
2247-
2248 \snippet code/src_corelib_io_qprocess.cpp 7-
2249-
2250 After the \a command string has been split and unquoted, this function-
2251 behaves like the overload which takes the arguments as a string list.-
2252-
2253 You can disable this overload by defining \c-
2254 QT_NO_PROCESS_COMBINED_ARGUMENT_START when you compile your applications.-
2255 This can be useful if you want to ensure that you are not splitting arguments-
2256 unintentionally, for example. In virtually all cases, using the other overload-
2257 is the preferred method.-
2258-
2259 On operating systems where the system API for passing command line-
2260 arguments to a subprocess natively uses a single string (Windows), one can-
2261 conceive command lines which cannot be passed via QProcess's portable-
2262 list-based API. In these rare cases you need to use setProgram() and-
2263 setNativeArguments() instead of this function.-
2264-
2265*/-
2266#if !defined(QT_NO_PROCESS_COMBINED_ARGUMENT_START)-
2267void QProcess::start(const QString &command, OpenMode mode)-
2268{-
2269 QStringList args = parseCombinedArgString(command);-
2270 if (args.isEmpty()) {
args.isEmpty()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 1318 times by 16 tests
Evaluated by:
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_QUuid
  • tst_qmessagehandler
  • tst_qprocess - unknown status
4-1318
2271 Q_D(QProcess);-
2272 d->setErrorAndEmit(QProcess::FailedToStart, tr("No program defined"));-
2273 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_QProcess
4
2274 }-
2275-
2276 const QString prog = args.takeFirst();-
2277-
2278 start(prog, args, mode);-
2279}
executed 1318 times by 16 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUndoGroup
  • tst_QUndoStack
  • tst_QUuid
  • tst_qmessagehandler
  • tst_qprocess - unknown status
1318
2280#endif-
2281-
2282/*!-
2283 \since 5.0-
2284-
2285 Returns the program the process was last started with.-
2286-
2287 \sa start()-
2288*/-
2289QString QProcess::program() const-
2290{-
2291 Q_D(const QProcess);-
2292 return d->program;
executed 2 times by 2 tests: return d->program;
Executed by:
  • tst_QNetworkSession
  • tst_QProcess
2
2293}-
2294-
2295/*!-
2296 \since 5.1-
2297-
2298 Set the \a program to use when starting the process.-
2299 This function must be called before start().-
2300-
2301 \sa start(), setArguments(), program()-
2302*/-
2303void QProcess::setProgram(const QString &program)-
2304{-
2305 Q_D(QProcess);-
2306 if (d->processState != NotRunning) {
d->processState != NotRunningDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QProcess
0-2
2307 qWarning("QProcess::setProgram: Process is already running");-
2308 return;
never executed: return;
0
2309 }-
2310 d->program = program;-
2311}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QProcess
2
2312-
2313/*!-
2314 \since 5.0-
2315-
2316 Returns the command line arguments the process was last started with.-
2317-
2318 \sa start()-
2319*/-
2320QStringList QProcess::arguments() const-
2321{-
2322 Q_D(const QProcess);-
2323 return d->arguments;
executed 1 time by 1 test: return d->arguments;
Executed by:
  • tst_QProcess
1
2324}-
2325-
2326/*!-
2327 \since 5.1-
2328-
2329 Set the \a arguments to pass to the called program when starting the process.-
2330 This function must be called before start().-
2331-
2332 \sa start(), setProgram(), arguments()-
2333*/-
2334void QProcess::setArguments(const QStringList &arguments)-
2335{-
2336 Q_D(QProcess);-
2337 if (d->processState != NotRunning) {
d->processState != NotRunningDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QProcess
0-1
2338 qWarning("QProcess::setProgram: Process is already running");-
2339 return;
never executed: return;
0
2340 }-
2341 d->arguments = arguments;-
2342}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QProcess
1
2343-
2344/*!-
2345 Attempts to terminate the process.-
2346-
2347 The process may not exit as a result of calling this function (it is given-
2348 the chance to prompt the user for any unsaved files, etc).-
2349-
2350 On Windows, terminate() posts a WM_CLOSE message to all top-level windows-
2351 of the process and then to the main thread of the process itself. On Unix-
2352 and \macos the \c SIGTERM signal is sent.-
2353-
2354 Console applications on Windows that do not run an event loop, or whose-
2355 event loop does not handle the WM_CLOSE message, can only be terminated by-
2356 calling kill().-
2357-
2358 \sa kill()-
2359*/-
2360void QProcess::terminate()-
2361{-
2362 Q_D(QProcess);-
2363 d->terminateProcess();-
2364}
executed 14 times by 3 tests: end of block
Executed by:
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QProcess
14
2365-
2366/*!-
2367 Kills the current process, causing it to exit immediately.-
2368-
2369 On Windows, kill() uses TerminateProcess, and on Unix and \macos, the-
2370 SIGKILL signal is sent to the process.-
2371-
2372 \sa terminate()-
2373*/-
2374void QProcess::kill()-
2375{-
2376 Q_D(QProcess);-
2377 d->killProcess();-
2378}
executed 15 times by 7 tests: end of block
Executed by:
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QNetworkSession
  • tst_QProcess
  • tst_QSystemSemaphore
15
2379-
2380/*!-
2381 Returns the exit code of the last process that finished.-
2382-
2383 This value is not valid unless exitStatus() returns NormalExit.-
2384*/-
2385int QProcess::exitCode() const-
2386{-
2387 Q_D(const QProcess);-
2388 return d->exitCode;
executed 1261 times by 13 tests: return d->exitCode;
Executed by:
  • tst_Lancelot
  • tst_QIcon
  • tst_QNetworkSession
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSharedPointer
  • tst_QSystemSemaphore
  • tst_QTextCodec
  • tst_qdbusxml2cpp
  • tst_qmake
  • tst_qmakelib
  • tst_uic
1261
2389}-
2390-
2391/*!-
2392 \since 4.1-
2393-
2394 Returns the exit status of the last process that finished.-
2395-
2396 On Windows, if the process was terminated with TerminateProcess() from-
2397 another application, this function will still return NormalExit-
2398 unless the exit code is less than 0.-
2399*/-
2400QProcess::ExitStatus QProcess::exitStatus() const-
2401{-
2402 Q_D(const QProcess);-
2403 return d->exitStatus;
executed 1508 times by 11 tests: return d->exitStatus;
Executed by:
  • tst_QApplication
  • tst_QIcon
  • tst_QObject
  • tst_QProcess
  • tst_QProcess_and_GuiEventLoop
  • tst_QSystemSemaphore
  • tst_QTextCodec
  • tst_Selftests
  • tst_qmake
  • tst_qmakelib
  • tst_uic
1508
2404}-
2405-
2406/*!-
2407 Starts the program \a program with the arguments \a arguments in a-
2408 new process, waits for it to finish, and then returns the exit-
2409 code of the process. Any data the new process writes to the-
2410 console is forwarded to the calling process.-
2411-
2412 The environment and working directory are inherited from the calling-
2413 process.-
2414-
2415 Argument handling is identical to the respective start() overload.-
2416-
2417 If the process cannot be started, -2 is returned. If the process-
2418 crashes, -1 is returned. Otherwise, the process' exit code is-
2419 returned.-
2420-
2421 \sa start()-
2422*/-
2423int QProcess::execute(const QString &program, const QStringList &arguments)-
2424{-
2425 QProcess process;-
2426 process.setReadChannelMode(ForwardedChannels);-
2427 process.start(program, arguments);-
2428 if (!process.waitForFinished(-1) || process.error() == FailedToStart)
!process.waitForFinished(-1)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QLockFile
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QProcess
process.error(... FailedToStartDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QProcess
0-4
2429 return -2;
executed 4 times by 1 test: return -2;
Executed by:
  • tst_QLockFile
4
2430 return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1;
executed 1 time by 1 test: return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1;
Executed by:
  • tst_QProcess
1
2431}-
2432-
2433/*!-
2434 \overload-
2435-
2436 Starts the program \a command in a new process, waits for it to finish,-
2437 and then returns the exit code.-
2438-
2439 Argument handling is identical to the respective start() overload.-
2440-
2441 After the \a command string has been split and unquoted, this function-
2442 behaves like the overload which takes the arguments as a string list.-
2443-
2444 \sa start()-
2445*/-
2446int QProcess::execute(const QString &command)-
2447{-
2448 QProcess process;-
2449 process.setReadChannelMode(ForwardedChannels);-
2450 process.start(command);-
2451 if (!process.waitForFinished(-1) || process.error() == FailedToStart)
!process.waitForFinished(-1)Description
TRUEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QProcess
  • tst_QUndoGroup
  • tst_QUndoStack
FALSEnever evaluated
process.error(... FailedToStartDescription
TRUEnever evaluated
FALSEnever evaluated
0-4
2452 return -2;
executed 4 times by 3 tests: return -2;
Executed by:
  • tst_QProcess
  • tst_QUndoGroup
  • tst_QUndoStack
4
2453 return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1;
never executed: return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1;
0
2454}-
2455-
2456/*!-
2457 Starts the program \a program with the arguments \a arguments in a-
2458 new process, and detaches from it. Returns \c true on success;-
2459 otherwise returns \c false. If the calling process exits, the-
2460 detached process will continue to run unaffected.-
2461-
2462 Argument handling is identical to the respective start() overload.-
2463-
2464 \b{Unix:} The started process will run in its own session and act-
2465 like a daemon.-
2466-
2467 The process will be started in the directory \a workingDirectory.-
2468 If \a workingDirectory is empty, the working directory is inherited-
2469 from the calling process.-
2470-
2471 \note On QNX, this may cause all application threads to-
2472 temporarily freeze.-
2473-
2474 If the function is successful then *\a pid is set to the process-
2475 identifier of the started process.-
2476-
2477 \sa start()-
2478*/-
2479bool QProcess::startDetached(const QString &program,-
2480 const QStringList &arguments,-
2481 const QString &workingDirectory,-
2482 qint64 *pid)-
2483{-
2484 return QProcessPrivate::startDetached(program,
executed 1 time by 1 test: return QProcessPrivate::startDetached(program, arguments, workingDirectory, pid);
Executed by:
  • tst_QProcess
1
2485 arguments,
executed 1 time by 1 test: return QProcessPrivate::startDetached(program, arguments, workingDirectory, pid);
Executed by:
  • tst_QProcess
1
2486 workingDirectory,
executed 1 time by 1 test: return QProcessPrivate::startDetached(program, arguments, workingDirectory, pid);
Executed by:
  • tst_QProcess
1
2487 pid);
executed 1 time by 1 test: return QProcessPrivate::startDetached(program, arguments, workingDirectory, pid);
Executed by:
  • tst_QProcess
1
2488}-
2489-
2490/*!-
2491 \internal-
2492*/-
2493bool QProcess::startDetached(const QString &program,-
2494 const QStringList &arguments)-
2495{-
2496 return QProcessPrivate::startDetached(program, arguments);
executed 1 time by 1 test: return QProcessPrivate::startDetached(program, arguments);
Executed by:
  • tst_QProcess
1
2497}-
2498-
2499/*!-
2500 \overload-
2501-
2502 Starts the command \a command in a new process, and detaches from it.-
2503 Returns \c true on success; otherwise returns \c false.-
2504-
2505 Argument handling is identical to the respective start() overload.-
2506-
2507 After the \a command string has been split and unquoted, this function-
2508 behaves like the overload which takes the arguments as a string list.-
2509-
2510 \sa start(const QString &command, OpenMode mode)-
2511*/-
2512bool QProcess::startDetached(const QString &command)-
2513{-
2514 QStringList args = parseCombinedArgString(command);-
2515 if (args.isEmpty())
args.isEmpty()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QProcess
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QProcess
2-3
2516 return false;
executed 3 times by 1 test: return false;
Executed by:
  • tst_QProcess
3
2517-
2518 const QString prog = args.takeFirst();-
2519-
2520 return QProcessPrivate::startDetached(prog, args);
executed 2 times by 1 test: return QProcessPrivate::startDetached(prog, args);
Executed by:
  • tst_QProcess
2
2521}-
2522-
2523QT_BEGIN_INCLUDE_NAMESPACE-
2524#if defined(Q_OS_MACX)-
2525# include <crt_externs.h>-
2526# define environ (*_NSGetEnviron())-
2527#elif defined(Q_OS_WINCE) || defined(Q_OS_IOS)-
2528 static char *qt_empty_environ[] = { 0 };-
2529#define environ qt_empty_environ-
2530#elif !defined(Q_OS_WIN)-
2531 extern char **environ;-
2532#endif-
2533QT_END_INCLUDE_NAMESPACE-
2534-
2535/*!-
2536 \since 4.1-
2537-
2538 Returns the environment of the calling process as a list of-
2539 key=value pairs. Example:-
2540-
2541 \snippet code/src_corelib_io_qprocess.cpp 8-
2542-
2543 This function does not cache the system environment. Therefore, it's-
2544 possible to obtain an updated version of the environment if low-level C-
2545 library functions like \tt setenv or \tt putenv have been called.-
2546-
2547 However, note that repeated calls to this function will recreate the-
2548 list of environment variables, which is a non-trivial operation.-
2549-
2550 \note For new code, it is recommended to use QProcessEnvironment::systemEnvironment()-
2551-
2552 \sa QProcessEnvironment::systemEnvironment(), setProcessEnvironment()-
2553*/-
2554QStringList QProcess::systemEnvironment()-
2555{-
2556 QStringList tmp;-
2557 char *entry = 0;-
2558 int count = 0;-
2559 while ((entry = environ[count++]))
(entry = environ[count++])Description
TRUEevaluated 1651 times by 4 tests
Evaluated by:
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qmake
  • tst_qmessagehandler
FALSEevaluated 55 times by 4 tests
Evaluated by:
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qmake
  • tst_qmessagehandler
55-1651
2560 tmp << QString::fromLocal8Bit(entry);
executed 1651 times by 4 tests: tmp << QString::fromLocal8Bit(entry);
Executed by:
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qmake
  • tst_qmessagehandler
1651
2561 return tmp;
executed 55 times by 4 tests: return tmp;
Executed by:
  • tst_QProcess
  • tst_QSharedPointer
  • tst_qmake
  • tst_qmessagehandler
55
2562}-
2563-
2564/*!-
2565 \fn QProcessEnvironment QProcessEnvironment::systemEnvironment()-
2566-
2567 \since 4.6-
2568-
2569 \brief The systemEnvironment function returns the environment of-
2570 the calling process.-
2571-
2572 It is returned as a QProcessEnvironment. This function does not-
2573 cache the system environment. Therefore, it's possible to obtain-
2574 an updated version of the environment if low-level C library-
2575 functions like \tt setenv or \tt putenv have been called.-
2576-
2577 However, note that repeated calls to this function will recreate the-
2578 QProcessEnvironment object, which is a non-trivial operation.-
2579-
2580 \sa QProcess::systemEnvironment()-
2581*/-
2582-
2583/*!-
2584 \since 5.2-
2585-
2586 \brief The null device of the operating system.-
2587-
2588 The returned file path uses native directory separators.-
2589-
2590 \sa QProcess::setStandardInputFile(), QProcess::setStandardOutputFile(),-
2591 QProcess::setStandardErrorFile()-
2592*/-
2593QString QProcess::nullDevice()-
2594{-
2595#ifdef Q_OS_WIN-
2596 return QStringLiteral("\\\\.\\NUL");-
2597#else-
2598 return QStringLiteral("/dev/null");
executed 5 times by 1 test: return ([]() -> QString { enum { Size = sizeof(u"" "/dev/null")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/dev/null" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
Executed by:
  • tst_QProcess
executed 5 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QProcess
5
2599#endif-
2600}-
2601-
2602/*!-
2603 \typedef Q_PID-
2604 \relates QProcess-
2605-
2606 Typedef for the identifiers used to represent processes on the underlying-
2607 platform. On Unix, this corresponds to \l qint64; on Windows, it-
2608 corresponds to \c{_PROCESS_INFORMATION*}.-
2609-
2610 \sa QProcess::pid()-
2611*/-
2612-
2613QT_END_NAMESPACE-
2614-
2615#include "moc_qprocess.cpp"-
2616-
2617#endif // QT_NO_PROCESS-
2618-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9