8#include "daq/slc/system/Executor.h"
9#include "daq/slc/system/LogFile.h"
18void Executor::setExecutable(
const char* format, ...)
23 vsprintf(ss, format, ap);
28void Executor::setExecutable(
const std::string& path)
33void Executor::addArg(
const char* format, ...)
38 vsprintf(ss, format, ap);
40 m_arg_v.push_back(ss);
43void Executor::addArg(
const std::string& arg)
45 m_arg_v.push_back(arg);
48bool Executor::execute(
bool isdaemon)
51 argv[0] = (
char*)m_path.c_str();
52 std::cerr <<
"" << argv[0] <<
" ";
53 for (
size_t i = 0; i < m_arg_v.size(); i++) {
54 argv[i + 1] = (
char*)m_arg_v[i].c_str();
55 std::cerr <<
"" << argv[i + 1] <<
" ";
57 std::cerr << std::endl;
58 argv[m_arg_v.size() + 1] = NULL;
59 if (isdaemon) daemon(0, 0);
60 if (execvp(m_path.c_str(), argv) == -1) {
61 LogFile::error(
"Faield to start %s", argv[0]);
Abstract base class for different kinds of events.