Switch to unified view

a/src/utils/execmd.h b/src/utils/execmd.h
...
...
71
 * of concerns with multithreaded programs).
71
 * of concerns with multithreaded programs).
72
 *
72
 *
73
 */
73
 */
74
class ExecCmd {
74
class ExecCmd {
75
 public:
75
 public:
76
    // Use vfork instead of fork. This must not be called in a multithreaded 
77
    // program.
78
    static void useVfork(bool on)
79
    {
80
  o_useVfork  = on;
81
    }
76
    /** 
82
    /** 
77
     * Add/replace environment variable before executing command. This must
83
     * Add/replace environment variable before executing command. This must
78
     * be called before doexec() to have an effect (possibly multiple
84
     * be called before doexec() to have an effect (possibly multiple
79
     * times for several variables).
85
     * times for several variables).
80
     * @param envassign an environment assignment string ("name=value")
86
     * @param envassign an environment assignment string ("name=value")
...
...
153
    /**
159
    /**
154
     * Get rid of current process (become ready for start). 
160
     * Get rid of current process (become ready for start). 
155
     */
161
     */
156
    void zapChild() {setKill(); (void)wait();}
162
    void zapChild() {setKill(); (void)wait();}
157
163
158
    ExecCmd() 
164
    ExecCmd()
159
    : m_advise(0), m_provide(0), m_timeoutMs(1000)
165
    : m_advise(0), m_provide(0), m_timeoutMs(1000)
160
    {
166
    {
161
    reset();
167
    reset();
162
    }
168
    }
163
    ~ExecCmd();
169
    ~ExecCmd();
...
...
172
     */
178
     */
173
    static bool which(const string& cmd, string& exe, const char* path = 0);
179
    static bool which(const string& cmd, string& exe, const char* path = 0);
174
180
175
    friend class ExecCmdRsrc;
181
    friend class ExecCmdRsrc;
176
 private:
182
 private:
183
    static bool      o_useVfork;
184
177
    vector<string>   m_env;
185
    vector<string>   m_env;
178
    ExecCmdAdvise   *m_advise;
186
    ExecCmdAdvise   *m_advise;
179
    ExecCmdProvide  *m_provide;
187
    ExecCmdProvide  *m_provide;
180
    bool             m_killRequest;
188
    bool             m_killRequest;
181
    int              m_timeoutMs;
189
    int              m_timeoutMs;
...
...
198
    m_pipein[0] = m_pipein[1] = m_pipeout[0] = m_pipeout[1] = -1;
206
    m_pipein[0] = m_pipein[1] = m_pipeout[0] = m_pipeout[1] = -1;
199
    m_pid = -1;
207
    m_pid = -1;
200
    sigemptyset(&m_blkcld);
208
    sigemptyset(&m_blkcld);
201
    }
209
    }
202
    // Child process code
210
    // Child process code
203
    void dochild(const string &cmd, const vector<string>& args, 
211
    inline void dochild(const string &cmd, const char **argv, 
204
         bool has_input, bool has_output);
212
          const char **envv, bool has_input, bool has_output);
205
    /* Copyconst and assignment private and forbidden */
213
    /* Copyconst and assignment private and forbidden */
206
    ExecCmd(const ExecCmd &) {}
214
    ExecCmd(const ExecCmd &) {}
207
    ExecCmd& operator=(const ExecCmd &) {return *this;};
215
    ExecCmd& operator=(const ExecCmd &) {return *this;};
208
};
216
};
209
217