@@ -50,7 +50,7 @@ class DockerFileTransformer {
50
50
const bool verbose_; // /< --verbose on cmd-line
51
51
int lineNum_; // /< line number being read
52
52
53
- bool transformRunLine (std::string *);
53
+ void transformRunLine (std::string *);
54
54
55
55
// / match ... in RUN ...
56
56
const RE reLineRun_ = RE(" ^RUN (.*)$" );
@@ -163,30 +163,23 @@ std::string runLineFromExecList(const TStringList &execList)
163
163
return runLine;
164
164
}
165
165
166
- bool DockerFileTransformer::transformRunLine (std::string *pRunLine)
166
+ void DockerFileTransformer::transformRunLine (std::string *pRunLine)
167
167
{
168
168
// start with the prefix specified on cmd-line
169
169
TStringList execList = prefixCmd_;
170
170
171
- try {
172
- boost::smatch sm;
173
- if (boost::regex_match (*pRunLine, sm, reLineRunExec_))
174
- // RUN ["cmd", "arg1", "arg2", ...]
175
- appendExecArgs (&execList, sm[1 ]);
171
+ boost::smatch sm;
172
+ if (boost::regex_match (*pRunLine, sm, reLineRunExec_))
173
+ // RUN ["cmd", "arg1", "arg2", ...]
174
+ appendExecArgs (&execList, sm[1 ]);
176
175
177
- else if (boost::regex_match (*pRunLine, sm, reLineRun_))
178
- // RUN arbitrary shell code...
179
- appendShellExec (&execList, sm[1 ]);
176
+ else if (boost::regex_match (*pRunLine, sm, reLineRun_))
177
+ // RUN arbitrary shell code...
178
+ appendShellExec (&execList, sm[1 ]);
180
179
181
- else
182
- // should never happen
183
- throw std::runtime_error (" internal error" );
184
- }
185
- catch (const std::runtime_error &e) {
186
- std::cerr << prog_name << " error: parsing error on line "
187
- << lineNum_ << " : " << e.what () << std::endl;
188
- return false ;
189
- }
180
+ else
181
+ // should never happen
182
+ throw std::runtime_error (" internal error" );
190
183
191
184
const std::string newRunLine = runLineFromExecList (execList);
192
185
if (verbose_) {
@@ -197,7 +190,6 @@ bool DockerFileTransformer::transformRunLine(std::string *pRunLine)
197
190
198
191
// return the result of a successful transformation
199
192
*pRunLine = newRunLine;
200
- return true ;
201
193
}
202
194
203
195
bool DockerFileTransformer::transform (std::istream &in, std::ostream &out)
@@ -237,8 +229,14 @@ bool DockerFileTransformer::transform(std::istream &in, std::ostream &out)
237
229
continue ;
238
230
239
231
// transform the linearized RUN line
240
- if (!this ->transformRunLine (&runLine))
232
+ try {
233
+ this ->transformRunLine (&runLine);
234
+ }
235
+ catch (const std::runtime_error &e) {
236
+ std::cerr << prog_name << " error: parsing error on line "
237
+ << lineNum_ << " : " << e.what () << std::endl;
241
238
anyError = true ;
239
+ }
242
240
243
241
// write the transformed RUN line and update state
244
242
out << runLine << std::endl;
0 commit comments