1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - .lcov.total - src/executor.h</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">src</a> - executor.h<span style="font-size: 80%;"> (source / <a href="executor.h.func-sort-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">.lcov.total</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntryLo">50.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2018-06-12 11:27:04</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">2</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntryLo">22.2 %</td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Line data Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum"> 1 </span> : #ifndef EXECUTOR_H</a>
<span class="lineNum"> 2 </span> : #define EXECUTOR_H
<span class="lineNum"> 3 </span> :
<span class="lineNum"> 4 </span> : #include <QObject>
<span class="lineNum"> 5 </span> : #include <QProcess>
<span class="lineNum"> 6 </span> : #include <QQueue>
<span class="lineNum"> 7 </span> :
<span class="lineNum"> 8 </span> : /*!
<span class="lineNum"> 9 </span> : \class Executor
<a name="10"><span class="lineNum"> 10 </span> : \brief Executes external commands for handleing password, git and other data</a>
<span class="lineNum"> 11 </span> : */
<span class="lineNum"> 12 </span><span class="lineCov"> 16 : class Executor : public QObject {</span>
<span class="lineNum"> 13 </span> : Q_OBJECT
<span class="lineNum"> 14 </span> :
<span class="lineNum"> 15 </span> : /*!
<span class="lineNum"> 16 </span> : \struct execQueueItem
<a name="17"><span class="lineNum"> 17 </span> : \brief Execution queue items for non-interactive ordered execution.</a>
<span class="lineNum"> 18 </span> : */
<span class="lineNum"> 19 </span><span class="lineNoCov"> 0 : struct execQueueItem {</span>
<span class="lineNum"> 20 </span> : /**
<span class="lineNum"> 21 </span> : * @brief id identifier of process given by the caller
<span class="lineNum"> 22 </span> : */
<span class="lineNum"> 23 </span> : int id;
<span class="lineNum"> 24 </span> : /**
<span class="lineNum"> 25 </span> : * @brief app executable path.
<span class="lineNum"> 26 </span> : */
<span class="lineNum"> 27 </span> : QString app;
<span class="lineNum"> 28 </span> : /**
<span class="lineNum"> 29 </span> : * @brief args arguments for executable.
<span class="lineNum"> 30 </span> : */
<span class="lineNum"> 31 </span> : QStringList args;
<span class="lineNum"> 32 </span> : /**
<span class="lineNum"> 33 </span> : * @brief input data to write to stdin of process
<span class="lineNum"> 34 </span> : */
<span class="lineNum"> 35 </span> : QString input;
<span class="lineNum"> 36 </span> : /**
<span class="lineNum"> 37 </span> : * @brief readStdout whether to read stdout
<span class="lineNum"> 38 </span> : */
<span class="lineNum"> 39 </span> : bool readStdout;
<span class="lineNum"> 40 </span> : /**
<span class="lineNum"> 41 </span> : * @brief readStderr whether to read stderr
<span class="lineNum"> 42 </span> : * it's read regardless of this setting in case of
<span class="lineNum"> 43 </span> : * non-0 return value of process
<span class="lineNum"> 44 </span> : */
<span class="lineNum"> 45 </span> : bool readStderr;
<span class="lineNum"> 46 </span> : /**
<span class="lineNum"> 47 </span> : * @brief workingDir working directory in which the process will be
<span class="lineNum"> 48 </span> : * started
<span class="lineNum"> 49 </span> : */
<span class="lineNum"> 50 </span> : QString workingDir;
<span class="lineNum"> 51 </span> : };
<span class="lineNum"> 52 </span> :
<span class="lineNum"> 53 </span> : QQueue<execQueueItem> m_execQueue;
<span class="lineNum"> 54 </span> : QProcess m_process;
<span class="lineNum"> 55 </span> : bool running;
<span class="lineNum"> 56 </span> : void executeNext();
<span class="lineNum"> 57 </span> :
<span class="lineNum"> 58 </span> : public:
<span class="lineNum"> 59 </span> : explicit Executor(QObject *parent = 0);
<span class="lineNum"> 60 </span> :
<span class="lineNum"> 61 </span> : void execute(int id, const QString &app, const QStringList &args,
<span class="lineNum"> 62 </span> : bool readStdout, bool readStderr = true);
<span class="lineNum"> 63 </span> :
<span class="lineNum"> 64 </span> : void execute(int id, const QString &workDir, const QString &app,
<span class="lineNum"> 65 </span> : const QStringList &args, bool readStdout,
<span class="lineNum"> 66 </span> : bool readStderr = true);
<span class="lineNum"> 67 </span> :
<span class="lineNum"> 68 </span> : void execute(int id, const QString &app, const QStringList &args,
<span class="lineNum"> 69 </span> : QString input = QString(), bool readStdout = false,
<span class="lineNum"> 70 </span> : bool readStderr = true);
<span class="lineNum"> 71 </span> :
<span class="lineNum"> 72 </span> : void execute(int id, const QString &workDir, const QString &app,
<span class="lineNum"> 73 </span> : const QStringList &args, QString input = QString(),
<span class="lineNum"> 74 </span> : bool readStdout = false, bool readStderr = true);
<span class="lineNum"> 75 </span> :
<span class="lineNum"> 76 </span> : int executeBlocking(QString app, const QStringList &args,
<span class="lineNum"> 77 </span> : QString input = QString(),
<span class="lineNum"> 78 </span> : QString *process_out = Q_NULLPTR,
<span class="lineNum"> 79 </span> : QString *process_err = Q_NULLPTR);
<span class="lineNum"> 80 </span> :
<span class="lineNum"> 81 </span> : int executeBlocking(QString app, const QStringList &args,
<span class="lineNum"> 82 </span> : QString *process_out, QString *process_err = Q_NULLPTR);
<span class="lineNum"> 83 </span> :
<span class="lineNum"> 84 </span> : void setEnvironment(const QStringList &env);
<span class="lineNum"> 85 </span> :
<span class="lineNum"> 86 </span> : int cancelNext();
<span class="lineNum"> 87 </span> : private slots:
<span class="lineNum"> 88 </span> : void finished(int exitCode, QProcess::ExitStatus exitStatus);
<span class="lineNum"> 89 </span> : signals:
<span class="lineNum"> 90 </span> : /**
<span class="lineNum"> 91 </span> : * @brief finished signal that is emited when process finishes
<span class="lineNum"> 92 </span> : *
<span class="lineNum"> 93 </span> : * @param id id of the process
<span class="lineNum"> 94 </span> : * @param exitCode return code of the process
<span class="lineNum"> 95 </span> : * @param output stdout produced by the process
<span class="lineNum"> 96 </span> : * @param errout stderr produced by the process
<span class="lineNum"> 97 </span> : */
<span class="lineNum"> 98 </span> : void finished(int id, int exitCode, const QString &output,
<span class="lineNum"> 99 </span> : const QString &errout);
<span class="lineNum"> 100 </span> : /**
<span class="lineNum"> 101 </span> : * @brief starting signal that is emited when process starts
<span class="lineNum"> 102 </span> : */
<span class="lineNum"> 103 </span> : void starting();
<span class="lineNum"> 104 </span> : /**
<span class="lineNum"> 105 </span> : * @brief error signal that is emited when process finishes with an
<span class="lineNum"> 106 </span> : * error
<span class="lineNum"> 107 </span> : *
<span class="lineN
|