-rw-r--r-- | lib/component_factory.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/component_factory.cc b/lib/component_factory.cc index b8f5a16..1253111 100644 --- a/lib/component_factory.cc +++ b/lib/component_factory.cc | |||
@@ -258,75 +258,75 @@ namespace sitecing { | |||
258 | ofstream sfs(sf.c_str(),ios::trunc|ios::out); // touch .pp_stamp | 258 | ofstream sfs(sf.c_str(),ios::trunc|ios::out); // touch .pp_stamp |
259 | }catch(preprocessor_error& pe) { | 259 | }catch(preprocessor_error& pe) { |
260 | pe.component_name = noro; | 260 | pe.component_name = noro; |
261 | pe.see(CODEPOINT); | 261 | pe.see(CODEPOINT); |
262 | throw; | 262 | throw; |
263 | } | 263 | } |
264 | return; | 264 | return; |
265 | }catch(utility_no_affix& una) { | 265 | }catch(utility_no_affix& una) { |
266 | // must be a crap from .d file | 266 | // must be a crap from .d file |
267 | } | 267 | } |
268 | } | 268 | } |
269 | cerr << "ignoring build request for " << dp << endl; | 269 | cerr << "ignoring build request for " << dp << endl; |
270 | } | 270 | } |
271 | 271 | ||
272 | int component_factory::execute(const string& cmd, const list<string>& args,int stdo,int stde) { | 272 | int component_factory::execute(const string& cmd, const list<string>& args,int stdo,int stde) { |
273 | // XXX: is it right that we do stdio/stderr tricks outside of the function? | 273 | // XXX: is it right that we do stdio/stderr tricks outside of the function? |
274 | cerr << "executing: " << cmd; | 274 | cerr << "executing: " << cmd; |
275 | vector<const char*> argv(args.size()+2); | 275 | vector<const char*> argv(args.size()+2); |
276 | argv[0]=cmd.c_str(); | 276 | argv[0]=cmd.c_str(); |
277 | int an = 1; | 277 | int an = 1; |
278 | for(list<string>::const_iterator i=args.begin();i!=args.end();i++) { | 278 | for(list<string>::const_iterator i=args.begin();i!=args.end();i++) { |
279 | cerr << " " << *i ; | 279 | cerr << " " << *i ; |
280 | argv[an++] = i->c_str(); | 280 | argv[an++] = i->c_str(); |
281 | } | 281 | } |
282 | cerr << endl; | 282 | cerr << endl; |
283 | argv[an++]=NULL; | 283 | argv[an++]=NULL; |
284 | pid_t pid = vfork(); | 284 | pid_t pid = vfork(); |
285 | if(pid==-1) { | 285 | if(pid==-1) { |
286 | close(stdo); close(stde); | 286 | close(stdo); close(stde); |
287 | throw konforka::exception(CODEPOINT,"failed to vfork()"); | 287 | throw konforka::exception(CODEPOINT,"failed to vfork()"); |
288 | } | 288 | } |
289 | if(!pid) { | 289 | if(!pid) { |
290 | // child | 290 | // child |
291 | if(dup2(stdo,1)!=1) | 291 | if(dup2(stdo,1)!=1) |
292 | _exit(-1); | 292 | _exit(-1); |
293 | if(dup2(stde,2)!=2) | 293 | if(dup2(stde,2)!=2) |
294 | _exit(-1); | 294 | _exit(-1); |
295 | close(0); | 295 | close(0); |
296 | execvp(cmd.c_str(),(char**)&argv.front()); | 296 | execvp(cmd.c_str(),(char**)&argv.front()); |
297 | _exit(-1); | 297 | _exit(-1); |
298 | } | 298 | } |
299 | // parent | 299 | // parent |
300 | close(stdo); close(stde); | 300 | close(stdo); close(stde); |
301 | int rv; | 301 | int rv; |
302 | if(waitpid(pid,&rv,0)<0) | 302 | if(waitpid(pid,&rv,0)<0) |
303 | throw konforka::exception(CODEPOINT,"failed to waitpid()"); | 303 | throw konforka::exception(CODEPOINT,"failed to waitpid()"); |
304 | return rv; | 304 | return rv; |
305 | } | 305 | } |
306 | 306 | ||
307 | string component_factory::get_classname(const string& component) { | 307 | string component_factory::get_classname(const string& component) { |
308 | string cn = root_intermediate+normalize_path(component,strip_trailing_slash|strip_leading_slash)+".classname"; | 308 | string cn = root_intermediate+normalize_path(component,strip_trailing_slash|strip_leading_slash)+".classname"; |
309 | make(cn); | 309 | make(cn); |
310 | ifstream ifs(cn.c_str()); | 310 | ifstream ifs(cn.c_str()); |
311 | if(!ifs.good()) | 311 | if(!ifs.good()) |
312 | throw konforka::exception(CODEPOINT,"failed to access component .classname"); | 312 | throw konforka::exception(CODEPOINT,"failed to access component .classname"); |
313 | ifs >> cn; | 313 | ifs >> cn; |
314 | return cn; | 314 | return cn; |
315 | } | 315 | } |
316 | 316 | ||
317 | void component_factory::get_ancestors(const string& component,file_list_t& rv) { | 317 | void component_factory::get_ancestors(const string& component,file_list_t& rv) { |
318 | string cn = root_intermediate+normalize_path(component,strip_trailing_slash|strip_leading_slash)+".ancestors"; | 318 | string cn = root_intermediate+normalize_path(component,strip_trailing_slash|strip_leading_slash)+".ancestors"; |
319 | make(cn); | 319 | make(cn); |
320 | ifstream ifs(cn.c_str()); | 320 | ifstream ifs(cn.c_str()); |
321 | if(!ifs.good()) | 321 | if(!ifs.good()) |
322 | throw konforka::exception(CODEPOINT,"filed to access component .ancestors"); | 322 | throw konforka::exception(CODEPOINT,string("failed to access component '")+component+"' .ancestors"); |
323 | rv.clear(); | 323 | rv.clear(); |
324 | while(!ifs.eof()) { | 324 | while(!ifs.eof()) { |
325 | string a; | 325 | string a; |
326 | ifs >> a; | 326 | ifs >> a; |
327 | if(!a.empty()) | 327 | if(!a.empty()) |
328 | rv.push_back(a); | 328 | rv.push_back(a); |
329 | } | 329 | } |
330 | } | 330 | } |
331 | 331 | ||
332 | } | 332 | } |