io/qprocess.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9 -
10QStringList QProcessEnvironmentPrivate::toList() const -
11{ -
12 QStringList result; -
13 result.reserve(hash.size()); -
14 Hash::ConstIterator it = hash.constBegin(), -
15 end = hash.constEnd(); -
16 for ( ; it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:4
4-8
17 QString data = nameToString(it.key()); -
18 QString value = valueToString(it.value()); -
19 data.reserve(data.length() + value.length() + 1); -
20 data.append(QLatin1Char('=')); -
21 data.append(value); -
22 result << data; -
23 }
executed: }
Execution Count:8
8
24 return result;
executed: return result;
Execution Count:4
4
25} -
26 -
27QProcessEnvironment QProcessEnvironmentPrivate::fromList(const QStringList &list) -
28{ -
29 QProcessEnvironment env; -
30 QStringList::ConstIterator it = list.constBegin(), -
31 end = list.constEnd(); -
32 for ( ; it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:1975
yes
Evaluation Count:87
87-1975
33 int pos = it->indexOf(QLatin1Char('=')); -
34 if (pos < 1)
partially evaluated: pos < 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1975
0-1975
35 continue;
never executed: continue;
0
36 -
37 QString value = it->mid(pos + 1); -
38 QString name = *it; -
39 name.truncate(pos); -
40 env.insert(name, value); -
41 }
executed: }
Execution Count:1975
1975
42 return env;
executed: return env;
Execution Count:87
87
43} -
44 -
45QStringList QProcessEnvironmentPrivate::keys() const -
46{ -
47 QStringList result; -
48 result.reserve(hash.size()); -
49 Hash::ConstIterator it = hash.constBegin(), -
50 end = hash.constEnd(); -
51 for ( ; it != end; ++it)
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:4
4-11
52 result << nameToString(it.key());
executed: result << nameToString(it.key());
Execution Count:11
11
53 return result;
executed: return result;
Execution Count:4
4
54} -
55 -
56void QProcessEnvironmentPrivate::insert(const QProcessEnvironmentPrivate &other) -
57{ -
58 Hash::ConstIterator it = other.hash.constBegin(), -
59 end = other.hash.constEnd(); -
60 for ( ; it != end; ++it)
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
61 hash.insert(it.key(), it.value());
executed: hash.insert(it.key(), it.value());
Execution Count:3
3
62 -
63 -
64 QHash<QString, Key>::ConstIterator nit = other.nameMap.constBegin(), -
65 nend = other.nameMap.constEnd(); -
66 for ( ; nit != nend; ++nit)
evaluated: nit != nend
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
67 nameMap.insert(nit.key(), nit.value());
executed: nameMap.insert(nit.key(), nit.value());
Execution Count:3
3
68 -
69}
executed: }
Execution Count:1
1
70 -
71 -
72 -
73 -
74 -
75 -
76QProcessEnvironment::QProcessEnvironment() -
77 : d(0) -
78{ -
79}
executed: }
Execution Count:1834
1834
80 -
81 -
82 -
83 -
84QProcessEnvironment::~QProcessEnvironment() -
85{ -
86} -
87 -
88 -
89 -
90 -
91QProcessEnvironment::QProcessEnvironment(const QProcessEnvironment &other) -
92 : d(other.d) -
93{ -
94}
never executed: }
0
95 -
96 -
97 -
98 -
99 -
100QProcessEnvironment &QProcessEnvironment::operator=(const QProcessEnvironment &other) -
101{ -
102 d = other.d; -
103 return *this;
executed: return *this;
Execution Count:743
743
104} -
105bool QProcessEnvironment::operator==(const QProcessEnvironment &other) const -
106{ -
107 return d == other.d || (d && other.d && d->hash == other.d->hash);
executed: return d == other.d || (d && other.d && d->hash == other.d->hash);
Execution Count:5
5
108} -
109 -
110 -
111 -
112 -
113 -
114 -
115 -
116bool QProcessEnvironment::isEmpty() const -
117{ -
118 return d ? d->hash.isEmpty() : true;
executed: return d ? d->hash.isEmpty() : true;
Execution Count:6
6
119} -
120 -
121 -
122 -
123 -
124 -
125 -
126 -
127void QProcessEnvironment::clear() -
128{ -
129 if (d)
partially evaluated: d
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
130 d->hash.clear();
executed: d->hash.clear();
Execution Count:7
7
131 -
132 -
133}
executed: }
Execution Count:7
7
134bool QProcessEnvironment::contains(const QString &name) const -
135{ -
136 return d ? d->hash.contains(d->prepareName(name)) : false;
executed: return d ? d->hash.contains(d->prepareName(name)) : false;
Execution Count:14
14
137} -
138void QProcessEnvironment::insert(const QString &name, const QString &value) -
139{ -
140 -
141 d->hash.insert(d->prepareName(name), d->prepareValue(value)); -
142}
executed: }
Execution Count:2004
2004
143void QProcessEnvironment::remove(const QString &name) -
144{ -
145 if (d)
partially evaluated: d
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
146 d->hash.remove(d->prepareName(name));
executed: d->hash.remove(d->prepareName(name));
Execution Count:3
3
147}
executed: }
Execution Count:3
3
148QString QProcessEnvironment::value(const QString &name, const QString &defaultValue) const -
149{ -
150 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-18
151 return defaultValue;
never executed: return defaultValue;
0
152 -
153 QProcessEnvironmentPrivate::Hash::ConstIterator it = d->hash.constFind(d->prepareName(name)); -
154 if (it == d->hash.constEnd())
evaluated: it == d->hash.constEnd()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:16
2-16
155 return defaultValue;
executed: return defaultValue;
Execution Count:2
2
156 -
157 return d->valueToString(it.value());
executed: return d->valueToString(it.value());
Execution Count:16
16
158} -
159QStringList QProcessEnvironment::toStringList() const -
160{ -
161 return d ? d->toList() : QStringList();
executed: return d ? d->toList() : QStringList();
Execution Count:6
6
162} -
163 -
164 -
165 -
166 -
167 -
168 -
169 -
170QStringList QProcessEnvironment::keys() const -
171{ -
172 return d ? d->keys() : QStringList();
executed: return d ? d->keys() : QStringList();
Execution Count:5
5
173} -
174void QProcessEnvironment::insert(const QProcessEnvironment &e) -
175{ -
176 if (!e.d)
partially evaluated: !e.d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
177 return;
never executed: return;
0
178 -
179 -
180 d->insert(*e.d); -
181}
executed: }
Execution Count:1
1
182 -
183void QProcessPrivate::Channel::clear() -
184{ -
185 switch (type) { -
186 case PipeSource: -
187 qt_noop(); -
188 process->stdinChannel.type = Normal; -
189 process->stdinChannel.process = 0; -
190 break;
executed: break;
Execution Count:2
2
191 case PipeSink: -
192 qt_noop(); -
193 process->stdoutChannel.type = Normal; -
194 process->stdoutChannel.process = 0; -
195 break;
never executed: break;
0
196 } -
197 -
198 type = Normal; -
199 file.clear(); -
200 process = 0; -
201}
executed: }
Execution Count:13
13
202QProcessPrivate::QProcessPrivate() -
203{ -
204 processChannel = QProcess::StandardOutput; -
205 processChannelMode = QProcess::SeparateChannels; -
206 processError = QProcess::UnknownError; -
207 processState = QProcess::NotRunning; -
208 pid = 0; -
209 sequenceNumber = 0; -
210 exitCode = 0; -
211 exitStatus = QProcess::NormalExit; -
212 startupSocketNotifier = 0; -
213 deathNotifier = 0; -
214 childStartedPipe[0] = -1; -
215 childStartedPipe[1] = -1; -
216 deathPipe[0] = -1; -
217 deathPipe[1] = -1; -
218 exitCode = 0; -
219 crashed = false; -
220 dying = false; -
221 emittedReadyRead = false; -
222 emittedBytesWritten = false; -
223 serial = 0; -
224 -
225}
executed: }
Execution Count:1721
1721
226 -
227 -
228 -
229 -
230QProcessPrivate::~QProcessPrivate() -
231{ -
232 if (stdinChannel.process)
evaluated: stdinChannel.process
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1722
2-1722
233 stdinChannel.process->stdoutChannel.clear();
executed: stdinChannel.process->stdoutChannel.clear();
Execution Count:2
2
234 if (stdoutChannel.process)
partially evaluated: stdoutChannel.process
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1724
0-1724
235 stdoutChannel.process->stdinChannel.clear();
never executed: stdoutChannel.process->stdinChannel.clear();
0
236}
executed: }
Execution Count:1724
1724
237 -
238 -
239 -
240 -
241void QProcessPrivate::cleanup() -
242{ -
243 q_func()->setProcessState(QProcess::NotRunning); -
244 pid = 0; -
245 sequenceNumber = 0; -
246 dying = false; -
247 -
248 if (stdoutChannel.notifier) {
evaluated: stdoutChannel.notifier
TRUEFALSE
yes
Evaluation Count:2433
yes
Evaluation Count:1811
1811-2433
249 stdoutChannel.notifier->setEnabled(false); -
250 qDeleteInEventHandler(stdoutChannel.notifier); -
251 stdoutChannel.notifier = 0; -
252 }
executed: }
Execution Count:2433
2433
253 if (stderrChannel.notifier) {
evaluated: stderrChannel.notifier
TRUEFALSE
yes
Evaluation Count:2426
yes
Evaluation Count:1818
1818-2426
254 stderrChannel.notifier->setEnabled(false); -
255 qDeleteInEventHandler(stderrChannel.notifier); -
256 stderrChannel.notifier = 0; -
257 }
executed: }
Execution Count:2426
2426
258 if (stdinChannel.notifier) {
evaluated: stdinChannel.notifier
TRUEFALSE
yes
Evaluation Count:2234
yes
Evaluation Count:2010
2010-2234
259 stdinChannel.notifier->setEnabled(false); -
260 qDeleteInEventHandler(stdinChannel.notifier); -
261 stdinChannel.notifier = 0; -
262 }
executed: }
Execution Count:2234
2234
263 if (startupSocketNotifier) {
partially evaluated: startupSocketNotifier
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4244
0-4244
264 startupSocketNotifier->setEnabled(false); -
265 qDeleteInEventHandler(startupSocketNotifier); -
266 startupSocketNotifier = 0; -
267 }
never executed: }
0
268 if (deathNotifier) {
evaluated: deathNotifier
TRUEFALSE
yes
Evaluation Count:2439
yes
Evaluation Count:1805
1805-2439
269 deathNotifier->setEnabled(false); -
270 qDeleteInEventHandler(deathNotifier); -
271 deathNotifier = 0; -
272 }
executed: }
Execution Count:2439
2439
273 -
274 -
275 -
276 -
277 -
278 -
279 destroyChannel(&stdoutChannel); -
280 destroyChannel(&stderrChannel); -
281 destroyChannel(&stdinChannel); -
282 destroyPipe(childStartedPipe); -
283 destroyPipe(deathPipe); -
284 -
285 serial = 0; -
286 -
287}
executed: }
Execution Count:4244
4244
288 -
289 -
290 -
291 -
292bool QProcessPrivate::_q_canReadStandardOutput() -
293{ -
294 QProcess * const q = q_func(); -
295 qint64 available = bytesAvailableFromStdout(); -
296 if (available == 0) {
evaluated: available == 0
TRUEFALSE
yes
Evaluation Count:3349
yes
Evaluation Count:46306
3349-46306
297 if (stdoutChannel.notifier)
evaluated: stdoutChannel.notifier
TRUEFALSE
yes
Evaluation Count:3339
yes
Evaluation Count:10
10-3339
298 stdoutChannel.notifier->setEnabled(false);
executed: stdoutChannel.notifier->setEnabled(false);
Execution Count:3339
3339
299 destroyChannel(&stdoutChannel); -
300 -
301 -
302 -
303 return false;
executed: return false;
Execution Count:3349
3349
304 } -
305 -
306 char *ptr = outputReadBuffer.reserve(available); -
307 qint64 readBytes = readFromStdout(ptr, available); -
308 if (readBytes == -1) {
partially evaluated: readBytes == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:46306
0-46306
309 processError = QProcess::ReadError; -
310 q->setErrorString(QProcess::tr("Error reading from process")); -
311 q->error(processError); -
312 -
313 -
314 -
315 return false;
never executed: return false;
0
316 } -
317 -
318 -
319 -
320 -
321 -
322 if (stdoutChannel.closed) {
evaluated: stdoutChannel.closed
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:46301
5-46301
323 outputReadBuffer.chop(readBytes); -
324 return false;
executed: return false;
Execution Count:5
5
325 } -
326 -
327 outputReadBuffer.chop(available - readBytes); -
328 -
329 bool didRead = false; -
330 if (readBytes == 0) {
partially evaluated: readBytes == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:46301
0-46301
331 if (stdoutChannel.notifier)
never evaluated: stdoutChannel.notifier
0
332 stdoutChannel.notifier->setEnabled(false);
never executed: stdoutChannel.notifier->setEnabled(false);
0
333 } else if (processChannel == QProcess::StandardOutput) {
partially evaluated: processChannel == QProcess::StandardOutput
TRUEFALSE
yes
Evaluation Count:46301
no
Evaluation Count:0
never executed: }
0-46301
334 didRead = true; -
335 if (!emittedReadyRead) {
evaluated: !emittedReadyRead
TRUEFALSE
yes
Evaluation Count:46300
yes
Evaluation Count:1
1-46300
336 emittedReadyRead = true; -
337 q->readyRead(); -
338 emittedReadyRead = false; -
339 }
executed: }
Execution Count:46300
46300
340 }
executed: }
Execution Count:46301
46301
341 q->readyReadStandardOutput(QProcess::QPrivateSignal()); -
342 return didRead;
executed: return didRead;
Execution Count:46301
46301
343} -
344 -
345 -
346 -
347 -
348bool QProcessPrivate::_q_canReadStandardError() -
349{ -
350 QProcess * const q = q_func(); -
351 qint64 available = bytesAvailableFromStderr(); -
352 if (available == 0) {
evaluated: available == 0
TRUEFALSE
yes
Evaluation Count:3371
yes
Evaluation Count:359
359-3371
353 if (stderrChannel.notifier)
evaluated: stderrChannel.notifier
TRUEFALSE
yes
Evaluation Count:3354
yes
Evaluation Count:17
17-3354
354 stderrChannel.notifier->setEnabled(false);
executed: stderrChannel.notifier->setEnabled(false);
Execution Count:3354
3354
355 destroyChannel(&stderrChannel); -
356 return false;
executed: return false;
Execution Count:3371
3371
357 } -
358 -
359 char *ptr = errorReadBuffer.reserve(available); -
360 qint64 readBytes = readFromStderr(ptr, available); -
361 if (readBytes == -1) {
partially evaluated: readBytes == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:359
0-359
362 processError = QProcess::ReadError; -
363 q->setErrorString(QProcess::tr("Error reading from process")); -
364 q->error(processError); -
365 return false;
never executed: return false;
0
366 } -
367 if (stderrChannel.closed) {
evaluated: stderrChannel.closed
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:350
9-350
368 errorReadBuffer.chop(readBytes); -
369 return false;
executed: return false;
Execution Count:9
9
370 } -
371 -
372 errorReadBuffer.chop(available - readBytes); -
373 -
374 bool didRead = false; -
375 if (readBytes == 0) {
partially evaluated: readBytes == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:350
0-350
376 if (stderrChannel.notifier)
never evaluated: stderrChannel.notifier
0
377 stderrChannel.notifier->setEnabled(false);
never executed: stderrChannel.notifier->setEnabled(false);
0
378 } else if (processChannel == QProcess::StandardError) {
evaluated: processChannel == QProcess::StandardError
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:337
never executed: }
0-337
379 didRead = true; -
380 if (!emittedReadyRead) {
partially evaluated: !emittedReadyRead
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-13
381 emittedReadyRead = true; -
382 q->readyRead(); -
383 emittedReadyRead = false; -
384 }
executed: }
Execution Count:13
13
385 }
executed: }
Execution Count:13
13
386 q->readyReadStandardError(QProcess::QPrivateSignal()); -
387 return didRead;
executed: return didRead;
Execution Count:350
350
388} -
389 -
390 -
391 -
392 -
393bool QProcessPrivate::_q_canWrite() -
394{ -
395 QProcess * const q = q_func(); -
396 if (stdinChannel.notifier)
partially evaluated: stdinChannel.notifier
TRUEFALSE
yes
Evaluation Count:1175
no
Evaluation Count:0
0-1175
397 stdinChannel.notifier->setEnabled(false);
executed: stdinChannel.notifier->setEnabled(false);
Execution Count:1175
1175
398 -
399 if (writeBuffer.isEmpty()) {
partially evaluated: writeBuffer.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1175
0-1175
400 -
401 -
402 -
403 return false;
never executed: return false;
0
404 } -
405 -
406 qint64 written = writeToStdin(writeBuffer.readPointer(), -
407 writeBuffer.nextDataBlockSize()); -
408 if (written < 0) {
partially evaluated: written < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1175
0-1175
409 destroyChannel(&stdinChannel); -
410 processError = QProcess::WriteError; -
411 q->setErrorString(QProcess::tr("Error writing to process")); -
412 q->error(processError); -
413 return false;
never executed: return false;
0
414 } -
415 -
416 -
417 -
418 -
419 -
420 if (written != 0) {
partially evaluated: written != 0
TRUEFALSE
yes
Evaluation Count:1175
no
Evaluation Count:0
0-1175
421 writeBuffer.free(written); -
422 if (!emittedBytesWritten) {
evaluated: !emittedBytesWritten
TRUEFALSE
yes
Evaluation Count:1174
yes
Evaluation Count:1
1-1174
423 emittedBytesWritten = true; -
424 q->bytesWritten(written); -
425 emittedBytesWritten = false; -
426 }
executed: }
Execution Count:1174
1174
427 }
executed: }
Execution Count:1175
1175
428 if (stdinChannel.notifier && !writeBuffer.isEmpty())
partially evaluated: stdinChannel.notifier
TRUEFALSE
yes
Evaluation Count:1175
no
Evaluation Count:0
evaluated: !writeBuffer.isEmpty()
TRUEFALSE
yes
Evaluation Count:725
yes
Evaluation Count:450
0-1175
429 stdinChannel.notifier->setEnabled(true);
executed: stdinChannel.notifier->setEnabled(true);
Execution Count:725
725
430 if (writeBuffer.isEmpty() && stdinChannel.closed)
evaluated: writeBuffer.isEmpty()
TRUEFALSE
yes
Evaluation Count:450
yes
Evaluation Count:725
evaluated: stdinChannel.closed
TRUEFALSE
yes
Evaluation Count:114
yes
Evaluation Count:336
114-725
431 closeWriteChannel();
executed: closeWriteChannel();
Execution Count:114
114
432 return true;
executed: return true;
Execution Count:1175
1175
433} -
434 -
435 -
436 -
437 -
438bool QProcessPrivate::_q_processDied() -
439{ -
440 QProcess * const q = q_func(); -
441 -
442 -
443 -
444 -
445 if (!waitForDeadChild())
evaluated: !waitForDeadChild()
TRUEFALSE
yes
Evaluation Count:404
yes
Evaluation Count:1693
404-1693
446 return false;
executed: return false;
Execution Count:404
404
447 if (processState == QProcess::Starting) {
partially evaluated: processState == QProcess::Starting
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1693
0-1693
448 if (!_q_startupNotification())
never evaluated: !_q_startupNotification()
0
449 return true;
never executed: return true;
0
450 }
never executed: }
0
451 -
452 if (dying) {
partially evaluated: dying
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1693
0-1693
453 -
454 -
455 -
456 -
457 return true;
never executed: return true;
0
458 } -
459 dying = true; -
460 -
461 -
462 -
463 -
464 _q_canReadStandardOutput(); -
465 _q_canReadStandardError(); -
466 -
467 findExitCode(); -
468 -
469 if (crashed) {
evaluated: crashed
TRUEFALSE
yes
Evaluation Count:219
yes
Evaluation Count:1474
219-1474
470 exitStatus = QProcess::CrashExit; -
471 processError = QProcess::Crashed; -
472 q->setErrorString(QProcess::tr("Process crashed")); -
473 q->error(processError); -
474 }
executed: }
Execution Count:219
219
475 -
476 bool wasRunning = (processState == QProcess::Running); -
477 -
478 cleanup(); -
479 -
480 if (wasRunning) {
partially evaluated: wasRunning
TRUEFALSE
yes
Evaluation Count:1693
no
Evaluation Count:0
0-1693
481 -
482 q->readChannelFinished(); -
483 -
484 -
485 -
486 -
487 q->finished(exitCode); -
488 q->finished(exitCode, exitStatus); -
489 }
executed: }
Execution Count:1693
1693
490 -
491 -
492 -
493 return true;
executed: return true;
Execution Count:1693
1693
494} -
495 -
496 -
497 -
498 -
499bool QProcessPrivate::_q_startupNotification() -
500{ -
501 QProcess * const q = q_func(); -
502 -
503 -
504 -
505 -
506 if (startupSocketNotifier)
evaluated: startupSocketNotifier
TRUEFALSE
yes
Evaluation Count:2439
yes
Evaluation Count:81
81-2439
507 startupSocketNotifier->setEnabled(false);
executed: startupSocketNotifier->setEnabled(false);
Execution Count:2439
2439
508 if (processStarted()) {
evaluated: processStarted()
TRUEFALSE
yes
Evaluation Count:1693
yes
Evaluation Count:827
827-1693
509 q->setProcessState(QProcess::Running); -
510 q->started(QProcess::QPrivateSignal()); -
511 return true;
executed: return true;
Execution Count:1693
1693
512 } -
513 -
514 q->setProcessState(QProcess::NotRunning); -
515 processError = QProcess::FailedToStart; -
516 q->error(processError); -
517 -
518 -
519 waitForDeadChild(); -
520 findExitCode(); -
521 -
522 cleanup(); -
523 return false;
executed: return false;
Execution Count:827
827
524} -
525 -
526 -
527 -
528 -
529void QProcessPrivate::closeWriteChannel() -
530{ -
531 -
532 -
533 -
534 if (stdinChannel.notifier) {
partially evaluated: stdinChannel.notifier
TRUEFALSE
yes
Evaluation Count:202
no
Evaluation Count:0
0-202
535 extern void qDeleteInEventHandler(QObject *o); -
536 stdinChannel.notifier->setEnabled(false); -
537 if (stdinChannel.notifier) {
partially evaluated: stdinChannel.notifier
TRUEFALSE
yes
Evaluation Count:202
no
Evaluation Count:0
0-202
538 qDeleteInEventHandler(stdinChannel.notifier); -
539 stdinChannel.notifier = 0; -
540 }
executed: }
Execution Count:202
202
541 }
executed: }
Execution Count:202
202
542 -
543 -
544 -
545 -
546 -
547 destroyChannel(&stdinChannel); -
548}
executed: }
Execution Count:202
202
549 -
550 -
551 -
552 -
553QProcess::QProcess(QObject *parent) -
554 : QIODevice(*new QProcessPrivate, parent) -
555{ -
556 -
557 -
558 -
559}
executed: }
Execution Count:1721
1721
560 -
561 -
562 -
563 -
564 -
565 -
566 -
567QProcess::~QProcess() -
568{ -
569 QProcessPrivate * const d = d_func(); -
570 if (d->processState != NotRunning) {
evaluated: d->processState != NotRunning
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1723
1-1723
571 QMessageLogger("io/qprocess.cpp", 1152, __PRETTY_FUNCTION__).warning().nospace() -
572 << "QProcess: Destroyed while process (" << QDir::toNativeSeparators(program()) << ") is still running."; -
573 kill(); -
574 waitForFinished(); -
575 }
executed: }
Execution Count:1
1
576 -
577 -
578 d->findExitCode(); -
579 -
580 d->cleanup(); -
581}
executed: }
Execution Count:1724
1724
582QProcess::ProcessChannelMode QProcess::readChannelMode() const -
583{ -
584 return processChannelMode();
executed: return processChannelMode();
Execution Count:5
5
585} -
586void QProcess::setReadChannelMode(ProcessChannelMode mode) -
587{ -
588 setProcessChannelMode(mode); -
589}
executed: }
Execution Count:20
20
590QProcess::ProcessChannelMode QProcess::processChannelMode() const -
591{ -
592 const QProcessPrivate * const d = d_func(); -
593 return d->processChannelMode;
executed: return d->processChannelMode;
Execution Count:5
5
594} -
595void QProcess::setProcessChannelMode(ProcessChannelMode mode) -
596{ -
597 QProcessPrivate * const d = d_func(); -
598 d->processChannelMode = mode; -
599}
executed: }
Execution Count:143
143
600 -
601 -
602 -
603 -
604 -
605 -
606QProcess::ProcessChannel QProcess::readChannel() const -
607{ -
608 const QProcessPrivate * const d = d_func(); -
609 return d->processChannel;
executed: return d->processChannel;
Execution Count:1233
1233
610} -
611void QProcess::setReadChannel(ProcessChannel channel) -
612{ -
613 QProcessPrivate * const d = d_func(); -
614 if (d->processChannel != channel) {
evaluated: d->processChannel != channel
TRUEFALSE
yes
Evaluation Count:1490
yes
Evaluation Count:1008
1008-1490
615 QByteArray buf = d->buffer.readAll(); -
616 if (d->processChannel == QProcess::StandardOutput) {
evaluated: d->processChannel == QProcess::StandardOutput
TRUEFALSE
yes
Evaluation Count:750
yes
Evaluation Count:740
740-750
617 for (int i = buf.size() - 1; i >= 0; --i)
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:750
7-750
618 d->outputReadBuffer.ungetChar(buf.at(i));
executed: d->outputReadBuffer.ungetChar(buf.at(i));
Execution Count:7
7
619 } else {
executed: }
Execution Count:750
750
620 for (int i = buf.size() - 1; i >= 0; --i)
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:740
7-740
621 d->errorReadBuffer.ungetChar(buf.at(i));
executed: d->errorReadBuffer.ungetChar(buf.at(i));
Execution Count:7
7
622 }
executed: }
Execution Count:740
740
623 } -
624 d->processChannel = channel; -
625}
executed: }
Execution Count:2498
2498
626void QProcess::closeReadChannel(ProcessChannel channel) -
627{ -
628 QProcessPrivate * const d = d_func(); -
629 -
630 if (channel == StandardOutput)
evaluated: channel == StandardOutput
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:6
6
631 d->stdoutChannel.closed = true;
executed: d->stdoutChannel.closed = true;
Execution Count:6
6
632 else -
633 d->stderrChannel.closed = true;
executed: d->stderrChannel.closed = true;
Execution Count:6
6
634} -
635void QProcess::closeWriteChannel() -
636{ -
637 QProcessPrivate * const d = d_func(); -
638 d->stdinChannel.closed = true; -
639 if (d->writeBuffer.isEmpty())
evaluated: d->writeBuffer.isEmpty()
TRUEFALSE
yes
Evaluation Count:88
yes
Evaluation Count:114
88-114
640 d->closeWriteChannel();
executed: d->closeWriteChannel();
Execution Count:88
88
641}
executed: }
Execution Count:202
202
642void QProcess::setStandardInputFile(const QString &fileName) -
643{ -
644 QProcessPrivate * const d = d_func(); -
645 d->stdinChannel = fileName; -
646}
executed: }
Execution Count:1
1
647void QProcess::setStandardOutputFile(const QString &fileName, OpenMode mode) -
648{ -
649 qt_noop(); -
650 QProcessPrivate * const d = d_func(); -
651 -
652 d->stdoutChannel = fileName; -
653 d->stdoutChannel.append = mode == Append; -
654}
executed: }
Execution Count:4
4
655void QProcess::setStandardErrorFile(const QString &fileName, OpenMode mode) -
656{ -
657 qt_noop(); -
658 QProcessPrivate * const d = d_func(); -
659 -
660 d->stderrChannel = fileName; -
661 d->stderrChannel.append = mode == Append; -
662}
executed: }
Execution Count:2
2
663void QProcess::setStandardOutputProcess(QProcess *destination) -
664{ -
665 QProcessPrivate *dfrom = d_func(); -
666 QProcessPrivate *dto = destination->d_func(); -
667 dfrom->stdoutChannel.pipeTo(dto); -
668 dto->stdinChannel.pipeFrom(dfrom); -
669}
executed: }
Execution Count:2
2
670QString QProcess::workingDirectory() const -
671{ -
672 const QProcessPrivate * const d = d_func(); -
673 return d->workingDirectory;
executed: return d->workingDirectory;
Execution Count:1
1
674} -
675void QProcess::setWorkingDirectory(const QString &dir) -
676{ -
677 QProcessPrivate * const d = d_func(); -
678 d->workingDirectory = dir; -
679}
executed: }
Execution Count:75
75
680 -
681 -
682 -
683 -
684 -
685Q_PID QProcess::pid() const -
686{ -
687 const QProcessPrivate * const d = d_func(); -
688 return d->pid;
executed: return d->pid;
Execution Count:1
1
689} -
690 -
691 -
692 -
693 -
694 -
695 -
696 -
697bool QProcess::canReadLine() const -
698{ -
699 const QProcessPrivate * const d = d_func(); -
700 const QRingBuffer *readBuffer = (d->processChannel == QProcess::StandardError)
partially evaluated: (d->processChannel == QProcess::StandardError)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
701 ? &d->errorReadBuffer -
702 : &d->outputReadBuffer; -
703 return readBuffer->canReadLine() || QIODevice::canReadLine();
executed: return readBuffer->canReadLine() || QIODevice::canReadLine();
Execution Count:17
17
704} -
705 -
706 -
707 -
708 -
709 -
710 -
711void QProcess::close() -
712{ -
713 aboutToClose(); -
714 while (waitForBytesWritten(-1))
partially evaluated: waitForBytesWritten(-1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
715 ;
never executed: ;
0
716 kill(); -
717 waitForFinished(-1); -
718 QIODevice::close(); -
719}
executed: }
Execution Count:4
4
720 -
721 -
722 -
723 -
724 -
725 -
726bool QProcess::atEnd() const -
727{ -
728 const QProcessPrivate * const d = d_func(); -
729 const QRingBuffer *readBuffer = (d->processChannel == QProcess::StandardError)
partially evaluated: (d->processChannel == QProcess::StandardError)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:61
0-61
730 ? &d->errorReadBuffer -
731 : &d->outputReadBuffer; -
732 return QIODevice::atEnd() && (!isOpen() || readBuffer->isEmpty());
executed: return QIODevice::atEnd() && (!isOpen() || readBuffer->isEmpty());
Execution Count:61
61
733} -
734 -
735 -
736 -
737bool QProcess::isSequential() const -
738{ -
739 return true;
executed: return true;
Execution Count:1290
1290
740} -
741 -
742 -
743 -
744qint64 QProcess::bytesAvailable() const -
745{ -
746 const QProcessPrivate * const d = d_func(); -
747 const QRingBuffer *readBuffer = (d->processChannel == QProcess::StandardError)
evaluated: (d->processChannel == QProcess::StandardError)
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:736
15-736
748 ? &d->errorReadBuffer -
749 : &d->outputReadBuffer; -
750 -
751 -
752 -
753 -
754 return readBuffer->size() + QIODevice::bytesAvailable();
executed: return readBuffer->size() + QIODevice::bytesAvailable();
Execution Count:751
751
755} -
756 -
757 -
758 -
759qint64 QProcess::bytesToWrite() const -
760{ -
761 const QProcessPrivate * const d = d_func(); -
762 qint64 size = d->writeBuffer.size(); -
763 -
764 -
765 -
766 return size;
executed: return size;
Execution Count:837
837
767} -
768 -
769 -
770 -
771 -
772 -
773 -
774QProcess::ProcessError QProcess::error() const -
775{ -
776 const QProcessPrivate * const d = d_func(); -
777 return d->processError;
executed: return d->processError;
Execution Count:768
768
778} -
779 -
780 -
781 -
782 -
783 -
784 -
785QProcess::ProcessState QProcess::state() const -
786{ -
787 const QProcessPrivate * const d = d_func(); -
788 return d->processState;
executed: return d->processState;
Execution Count:82
82
789} -
790void QProcess::setEnvironment(const QStringList &environment) -
791{ -
792 setProcessEnvironment(QProcessEnvironmentPrivate::fromList(environment)); -
793}
executed: }
Execution Count:87
87
794QStringList QProcess::environment() const -
795{ -
796 const QProcessPrivate * const d = d_func(); -
797 return d->environment.toStringList();
executed: return d->environment.toStringList();
Execution Count:1
1
798} -
799void QProcess::setProcessEnvironment(const QProcessEnvironment &environment) -
800{ -
801 QProcessPrivate * const d = d_func(); -
802 d->environment = environment; -
803}
executed: }
Execution Count:742
742
804QProcessEnvironment QProcess::processEnvironment() const -
805{ -
806 const QProcessPrivate * const d = d_func(); -
807 return d->environment;
never executed: return d->environment;
0
808} -
809bool QProcess::waitForStarted(int msecs) -
810{ -
811 QProcessPrivate * const d = d_func(); -
812 if (d->processState == QProcess::Running)
partially evaluated: d->processState == QProcess::Running
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2316
0-2316
813 return true;
never executed: return true;
0
814 -
815 return d->waitForStarted(msecs);
executed: return d->waitForStarted(msecs);
Execution Count:2316
2316
816} -
817 -
818 -
819 -
820bool QProcess::waitForReadyRead(int msecs) -
821{ -
822 QProcessPrivate * const d = d_func(); -
823 -
824 if (d->processState == QProcess::NotRunning)
evaluated: d->processState == QProcess::NotRunning
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:415
1-415
825 return false;
executed: return false;
Execution Count:1
1
826 if (d->processChannel == QProcess::StandardOutput && d->stdoutChannel.closed)
evaluated: d->processChannel == QProcess::StandardOutput
TRUEFALSE
yes
Evaluation Count:399
yes
Evaluation Count:16
evaluated: d->stdoutChannel.closed
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:394
5-399
827 return false;
executed: return false;
Execution Count:5
5
828 if (d->processChannel == QProcess::StandardError && d->stderrChannel.closed)
evaluated: d->processChannel == QProcess::StandardError
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:394
evaluated: d->stderrChannel.closed
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:11
5-394
829 return false;
executed: return false;
Execution Count:5
5
830 return d->waitForReadyRead(msecs);
executed: return d->waitForReadyRead(msecs);
Execution Count:405
405
831} -
832 -
833 -
834 -
835bool QProcess::waitForBytesWritten(int msecs) -
836{ -
837 QProcessPrivate * const d = d_func(); -
838 if (d->processState == QProcess::NotRunning)
evaluated: d->processState == QProcess::NotRunning
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:830
1-830
839 return false;
executed: return false;
Execution Count:1
1
840 if (d->processState == QProcess::Starting) {
evaluated: d->processState == QProcess::Starting
TRUEFALSE
yes
Evaluation Count:201
yes
Evaluation Count:629
201-629
841 QElapsedTimer stopWatch; -
842 stopWatch.start(); -
843 bool started = waitForStarted(msecs); -
844 if (!started)
evaluated: !started
TRUEFALSE
yes
Evaluation Count:100
yes
Evaluation Count:101
100-101
845 return false;
executed: return false;
Execution Count:100
100
846 if (msecs != -1)
partially evaluated: msecs != -1
TRUEFALSE
yes
Evaluation Count:101
no
Evaluation Count:0
0-101
847 msecs -= stopWatch.elapsed();
executed: msecs -= stopWatch.elapsed();
Execution Count:101
101
848 }
executed: }
Execution Count:101
101
849 -
850 return d->waitForBytesWritten(msecs);
executed: return d->waitForBytesWritten(msecs);
Execution Count:730
730
851} -
852bool QProcess::waitForFinished(int msecs) -
853{ -
854 QProcessPrivate * const d = d_func(); -
855 if (d->processState == QProcess::NotRunning)
evaluated: d->processState == QProcess::NotRunning
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1830
2-1830
856 return false;
executed: return false;
Execution Count:2
2
857 if (d->processState == QProcess::Starting) {
evaluated: d->processState == QProcess::Starting
TRUEFALSE
yes
Evaluation Count:590
yes
Evaluation Count:1240
590-1240
858 QElapsedTimer stopWatch; -
859 stopWatch.start(); -
860 bool started = waitForStarted(msecs); -
861 if (!started)
evaluated: !started
TRUEFALSE
yes
Evaluation Count:185
yes
Evaluation Count:405
185-405
862 return false;
executed: return false;
Execution Count:185
185
863 if (msecs != -1)
evaluated: msecs != -1
TRUEFALSE
yes
Evaluation Count:404
yes
Evaluation Count:1
1-404
864 msecs -= stopWatch.elapsed();
executed: msecs -= stopWatch.elapsed();
Execution Count:404
404
865 }
executed: }
Execution Count:405
405
866 -
867 return d->waitForFinished(msecs);
executed: return d->waitForFinished(msecs);
Execution Count:1645
1645
868} -
869 -
870 -
871 -
872 -
873 -
874 -
875void QProcess::setProcessState(ProcessState state) -
876{ -
877 QProcessPrivate * const d = d_func(); -
878 if (d->processState == state)
evaluated: d->processState == state
TRUEFALSE
yes
Evaluation Count:2551
yes
Evaluation Count:6733
2551-6733
879 return;
executed: return;
Execution Count:2551
2551
880 d->processState = state; -
881 stateChanged(state, QPrivateSignal()); -
882}
executed: }
Execution Count:6733
6733
883void QProcess::setupChildProcess() -
884{ -
885} -
886 -
887 -
888 -
889qint64 QProcess::readData(char *data, qint64 maxlen) -
890{ -
891 QProcessPrivate * const d = d_func(); -
892 if (!maxlen)
evaluated: !maxlen
TRUEFALSE
yes
Evaluation Count:1468
yes
Evaluation Count:2822
1468-2822
893 return 0;
executed: return 0;
Execution Count:1468
1468
894 QRingBuffer *readBuffer = (d->processChannel == QProcess::StandardError)
evaluated: (d->processChannel == QProcess::StandardError)
TRUEFALSE
yes
Evaluation Count:831
yes
Evaluation Count:1991
831-1991
895 ? &d->errorReadBuffer -
896 : &d->outputReadBuffer; -
897 -
898 if (maxlen == 1 && !readBuffer->isEmpty()) {
partially evaluated: maxlen == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2822
never evaluated: !readBuffer->isEmpty()
0-2822
899 int c = readBuffer->getChar(); -
900 if (c == -1) {
never evaluated: c == -1
0
901 -
902 -
903 -
904 -
905 return -1;
never executed: return -1;
0
906 } -
907 *data = (char) c; -
908 -
909 -
910 -
911 -
912 return 1;
never executed: return 1;
0
913 } -
914 -
915 qint64 bytesToRead = qint64(qMin(readBuffer->size(), (int)maxlen)); -
916 qint64 readSoFar = 0; -
917 while (readSoFar < bytesToRead) {
evaluated: readSoFar < bytesToRead
TRUEFALSE
yes
Evaluation Count:1601
yes
Evaluation Count:2822
1601-2822
918 const char *ptr = readBuffer->readPointer(); -
919 int bytesToReadFromThisBlock = qMin<qint64>(bytesToRead - readSoFar, -
920 readBuffer->nextDataBlockSize()); -
921 memcpy(data + readSoFar, ptr, bytesToReadFromThisBlock); -
922 readSoFar += bytesToReadFromThisBlock; -
923 readBuffer->free(bytesToReadFromThisBlock); -
924 }
executed: }
Execution Count:1601
1601
925 -
926 -
927 -
928 -
929 -
930 if (!readSoFar && d->processState == QProcess::NotRunning)
evaluated: !readSoFar
TRUEFALSE
yes
Evaluation Count:1663
yes
Evaluation Count:1159
evaluated: d->processState == QProcess::NotRunning
TRUEFALSE
yes
Evaluation Count:1327
yes
Evaluation Count:336
336-1663
931 return -1;
executed: return -1;
Execution Count:1327
1327
932 return readSoFar;
executed: return readSoFar;
Execution Count:1495
1495
933} -
934 -
935 -
936 -
937qint64 QProcess::writeData(const char *data, qint64 len) -
938{ -
939 QProcessPrivate * const d = d_func(); -
940 if (d->stdinChannel.closed) {
evaluated: d->stdinChannel.closed
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:454
1-454
941 -
942 -
943 -
944 -
945 return 0;
executed: return 0;
Execution Count:1
1
946 } -
947 -
948 if (len == 1) {
evaluated: len == 1
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:420
34-420
949 d->writeBuffer.putChar(*data); -
950 if (d->stdinChannel.notifier)
partially evaluated: d->stdinChannel.notifier
TRUEFALSE
yes
Evaluation Count:34
no
Evaluation Count:0
0-34
951 d->stdinChannel.notifier->setEnabled(true);
executed: d->stdinChannel.notifier->setEnabled(true);
Execution Count:34
34
952 -
953 -
954 -
955 -
956 return 1;
executed: return 1;
Execution Count:34
34
957 } -
958 -
959 char *dest = d->writeBuffer.reserve(len); -
960 memcpy(dest, data, len); -
961 if (d->stdinChannel.notifier)
partially evaluated: d->stdinChannel.notifier
TRUEFALSE
yes
Evaluation Count:420
no
Evaluation Count:0
0-420
962 d->stdinChannel.notifier->setEnabled(true);
executed: d->stdinChannel.notifier->setEnabled(true);
Execution Count:420
420
963 -
964 -
965 -
966 -
967 return len;
executed: return len;
Execution Count:420
420
968} -
969QByteArray QProcess::readAllStandardOutput() -
970{ -
971 ProcessChannel tmp = readChannel(); -
972 setReadChannel(StandardOutput); -
973 QByteArray data = readAll(); -
974 setReadChannel(tmp); -
975 return data;
executed: return data;
Execution Count:500
500
976} -
977QByteArray QProcess::readAllStandardError() -
978{ -
979 ProcessChannel tmp = readChannel(); -
980 setReadChannel(StandardError); -
981 QByteArray data = readAll(); -
982 setReadChannel(tmp); -
983 return data;
executed: return data;
Execution Count:730
730
984} -
985void QProcess::start(const QString &program, const QStringList &arguments, OpenMode mode) -
986{ -
987 QProcessPrivate * const d = d_func(); -
988 if (d->processState != NotRunning) {
partially evaluated: d->processState != NotRunning
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2520
0-2520
989 QMessageLogger("io/qprocess.cpp", 1945, __PRETTY_FUNCTION__).warning("QProcess::start: Process is already running"); -
990 return;
never executed: return;
0
991 } -
992 -
993 -
994 -
995 -
996 -
997 d->outputReadBuffer.clear(); -
998 d->errorReadBuffer.clear(); -
999 -
1000 if (d->stdinChannel.type != QProcessPrivate::Channel::Normal)
evaluated: d->stdinChannel.type != QProcessPrivate::Channel::Normal
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2517
3-2517
1001 mode &= ~WriteOnly;
executed: mode &= ~WriteOnly;
Execution Count:3
3
1002 if (d->stdoutChannel.type != QProcessPrivate::Channel::Normal &&
evaluated: d->stdoutChannel.type != QProcessPrivate::Channel::Normal
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2514
6-2514
1003 (d->stderrChannel.type != QProcessPrivate::Channel::Normal ||
partially evaluated: d->stderrChannel.type != QProcessPrivate::Channel::Normal
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
1004 d->processChannelMode == MergedChannels))
evaluated: d->processChannelMode == MergedChannels
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3
1005 mode &= ~ReadOnly;
executed: mode &= ~ReadOnly;
Execution Count:3
3
1006 if (mode == 0)
partially evaluated: mode == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2520
0-2520
1007 mode = Unbuffered;
never executed: mode = Unbuffered;
0
1008 QIODevice::open(mode); -
1009 -
1010 d->stdinChannel.closed = false; -
1011 d->stdoutChannel.closed = false; -
1012 d->stderrChannel.closed = false; -
1013 -
1014 d->program = program; -
1015 d->arguments = arguments; -
1016 -
1017 d->exitCode = 0; -
1018 d->exitStatus = NormalExit; -
1019 d->processError = QProcess::UnknownError; -
1020 d->errorString.clear(); -
1021 d->startProcess(); -
1022}
executed: }
Execution Count:2520
2520
1023 -
1024 -
1025static QStringList parseCombinedArgString(const QString &program) -
1026{ -
1027 QStringList args; -
1028 QString tmp; -
1029 int quoteCount = 0; -
1030 bool inQuote = false; -
1031 -
1032 -
1033 -
1034 -
1035 for (int i = 0; i < program.size(); ++i) {
evaluated: i < program.size()
TRUEFALSE
yes
Evaluation Count:25473
yes
Evaluation Count:1084
1084-25473
1036 if (program.at(i) == QLatin1Char('"')) {
evaluated: program.at(i) == QLatin1Char('"')
TRUEFALSE
yes
Evaluation Count:372
yes
Evaluation Count:25103
372-25103
1037 ++quoteCount; -
1038 if (quoteCount == 3) {
evaluated: quoteCount == 3
TRUEFALSE
yes
Evaluation Count:84
yes
Evaluation Count:288
84-288
1039 -
1040 quoteCount = 0; -
1041 tmp += program.at(i); -
1042 }
executed: }
Execution Count:84
84
1043 continue;
executed: continue;
Execution Count:372
372
1044 } -
1045 if (quoteCount) {
evaluated: quoteCount
TRUEFALSE
yes
Evaluation Count:99
yes
Evaluation Count:25004
99-25004
1046 if (quoteCount == 1)
evaluated: quoteCount == 1
TRUEFALSE
yes
Evaluation Count:93
yes
Evaluation Count:6
6-93
1047 inQuote = !inQuote;
executed: inQuote = !inQuote;
Execution Count:93
93
1048 quoteCount = 0; -
1049 }
executed: }
Execution Count:99
99
1050 if (!inQuote && program.at(i).isSpace()) {
evaluated: !inQuote
TRUEFALSE
yes
Evaluation Count:24208
yes
Evaluation Count:894
evaluated: program.at(i).isSpace()
TRUEFALSE
yes
Evaluation Count:348
yes
Evaluation Count:23859
348-24208
1051 if (!tmp.isEmpty()) {
evaluated: !tmp.isEmpty()
TRUEFALSE
yes
Evaluation Count:335
yes
Evaluation Count:13
13-335
1052 args += tmp; -
1053 tmp.clear(); -
1054 }
executed: }
Execution Count:335
335
1055 } else {
executed: }
Execution Count:348
348
1056 tmp += program.at(i); -
1057 }
executed: }
Execution Count:24757
24757
1058 } -
1059 if (!tmp.isEmpty())
evaluated: !tmp.isEmpty()
TRUEFALSE
yes
Evaluation Count:1075
yes
Evaluation Count:9
9-1075
1060 args += tmp;
executed: args += tmp;
Execution Count:1075
1075
1061 -
1062 return args;
executed: return args;
Execution Count:1085
1085
1063} -
1064void QProcess::start(const QString &command, OpenMode mode) -
1065{ -
1066 QStringList args = parseCombinedArgString(command); -
1067 if (args.isEmpty()) {
evaluated: args.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1077
3-1077
1068 QProcessPrivate * const d = d_func(); -
1069 d->processError = QProcess::FailedToStart; -
1070 setErrorString(tr("No program defined")); -
1071 error(d->processError); -
1072 return;
executed: return;
Execution Count:3
3
1073 } -
1074 -
1075 QString prog = args.first(); -
1076 args.removeFirst(); -
1077 -
1078 start(prog, args, mode); -
1079}
executed: }
Execution Count:1077
1077
1080 -
1081 -
1082 -
1083 -
1084 -
1085 -
1086QString QProcess::program() const -
1087{ -
1088 const QProcessPrivate * const d = d_func(); -
1089 return d->program;
executed: return d->program;
Execution Count:1
1
1090} -
1091 -
1092 -
1093 -
1094 -
1095 -
1096 -
1097QStringList QProcess::arguments() const -
1098{ -
1099 const QProcessPrivate * const d = d_func(); -
1100 return d->arguments;
never executed: return d->arguments;
0
1101} -
1102void QProcess::terminate() -
1103{ -
1104 QProcessPrivate * const d = d_func(); -
1105 d->terminateProcess(); -
1106}
executed: }
Execution Count:153
153
1107void QProcess::kill() -
1108{ -
1109 QProcessPrivate * const d = d_func(); -
1110 d->killProcess(); -
1111}
executed: }
Execution Count:19
19
1112 -
1113 -
1114 -
1115 -
1116int QProcess::exitCode() const -
1117{ -
1118 const QProcessPrivate * const d = d_func(); -
1119 return d->exitCode;
executed: return d->exitCode;
Execution Count:555
555
1120} -
1121QProcess::ExitStatus QProcess::exitStatus() const -
1122{ -
1123 const QProcessPrivate * const d = d_func(); -
1124 return d->exitStatus;
executed: return d->exitStatus;
Execution Count:227
227
1125} -
1126int QProcess::execute(const QString &program, const QStringList &arguments) -
1127{ -
1128 QProcess process; -
1129 process.setReadChannelMode(ForwardedChannels); -
1130 process.start(program, arguments); -
1131 if (!process.waitForFinished(-1))
partially evaluated: !process.waitForFinished(-1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1132 return -2;
never executed: return -2;
0
1133 return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1;
executed: return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1;
Execution Count:1
1
1134} -
1135int QProcess::execute(const QString &program) -
1136{ -
1137 QProcess process; -
1138 process.setReadChannelMode(ForwardedChannels); -
1139 process.start(program); -
1140 if (!process.waitForFinished(-1))
partially evaluated: !process.waitForFinished(-1)
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
1141 return -2;
executed: return -2;
Execution Count:4
4
1142 return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1;
never executed: return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1;
0
1143} -
1144bool QProcess::startDetached(const QString &program, -
1145 const QStringList &arguments, -
1146 const QString &workingDirectory, -
1147 qint64 *pid) -
1148{ -
1149 return QProcessPrivate::startDetached(program, 1
1150 arguments, 1
1151 workingDirectory, 1
1152 pid);
executed: return QProcessPrivate::startDetached(program, arguments, workingDirectory, pid);
Execution Count:1
1
1153} -
1154bool QProcess::startDetached(const QString &program, -
1155 const QStringList &arguments) -
1156{ -
1157 return QProcessPrivate::startDetached(program, arguments);
executed: return QProcessPrivate::startDetached(program, arguments);
Execution Count:1
1
1158} -
1159bool QProcess::startDetached(const QString &program) -
1160{ -
1161 QStringList args = parseCombinedArgString(program); -
1162 if (args.isEmpty())
evaluated: args.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
1163 return false;
executed: return false;
Execution Count:3
3
1164 -
1165 QString prog = args.first(); -
1166 args.removeFirst(); -
1167 -
1168 return QProcessPrivate::startDetached(prog, args);
executed: return QProcessPrivate::startDetached(prog, args);
Execution Count:2
2
1169} -
1170 -
1171 -
1172 -
1173 -
1174 -
1175 -
1176 -
1177 -
1178 -
1179 extern char **environ; -
1180 -
1181 -
1182QStringList QProcess::systemEnvironment() -
1183{ -
1184 QStringList tmp; -
1185 char *entry = 0; -
1186 int count = 0; -
1187 while ((entry = environ[count++]))
evaluated: (entry = environ[count++])
TRUEFALSE
yes
Evaluation Count:1253
yes
Evaluation Count:55
55-1253
1188 tmp << QString::fromLocal8Bit(entry);
executed: tmp << QString::fromLocal8Bit(entry);
Execution Count:1253
1253
1189 return tmp;
executed: return tmp;
Execution Count:55
55
1190} -
1191 -
1192 -
1193 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial