summaryrefslogtreecommitdiff
path: root/libopie/oprocess.h
Unidiff
Diffstat (limited to 'libopie/oprocess.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/oprocess.h6
1 files changed, 0 insertions, 6 deletions
diff --git a/libopie/oprocess.h b/libopie/oprocess.h
index f2853b0..af7cddb 100644
--- a/libopie/oprocess.h
+++ b/libopie/oprocess.h
@@ -181,262 +181,256 @@ public:
181 NotifyOnExit, 181 NotifyOnExit,
182 /** 182 /**
183 * The application is suspended until the started process is finished. 183 * The application is suspended until the started process is finished.
184 */ 184 */
185 Block }; 185 Block };
186 186
187 /** 187 /**
188 * Constructor 188 * Constructor
189 */ 189 */
190 OProcess(QObject *parent = 0, const char *name = 0); 190 OProcess(QObject *parent = 0, const char *name = 0);
191 /** 191 /**
192 * Constructor 192 * Constructor
193 */ 193 */
194 OProcess(const QString &arg0, QObject *parent = 0, const char *name = 0); 194 OProcess(const QString &arg0, QObject *parent = 0, const char *name = 0);
195 /** 195 /**
196 * Constructor 196 * Constructor
197 */ 197 */
198 OProcess(const QStringList &args, QObject *parent = 0, const char *name = 0); 198 OProcess(const QStringList &args, QObject *parent = 0, const char *name = 0);
199 199
200 /** 200 /**
201 *Destructor: 201 *Destructor:
202 * 202 *
203 * If the process is running when the destructor for this class 203 * If the process is running when the destructor for this class
204 * is called, the child process is killed with a SIGKILL, but 204 * is called, the child process is killed with a SIGKILL, but
205 * only if the run mode is not of type @p DontCare. 205 * only if the run mode is not of type @p DontCare.
206 * Processes started as @p DontCare keep running anyway. 206 * Processes started as @p DontCare keep running anyway.
207 */ 207 */
208 virtual ~OProcess(); 208 virtual ~OProcess();
209 209
210 /** 210 /**
211 @deprecated 211 @deprecated
212 212
213 The use of this function is now deprecated. -- Please use the 213 The use of this function is now deprecated. -- Please use the
214 "operator<<" instead of "setExecutable". 214 "operator<<" instead of "setExecutable".
215 215
216 Sets the executable to be started with this OProcess object. 216 Sets the executable to be started with this OProcess object.
217 Returns false if the process is currently running (in that 217 Returns false if the process is currently running (in that
218 case the executable remains unchanged.) 218 case the executable remains unchanged.)
219 219
220 @see operator<< 220 @see operator<<
221 221
222 */ 222 */
223 bool setExecutable(const QString& proc); 223 bool setExecutable(const QString& proc);
224 224
225 225
226 /** 226 /**
227 * Sets the executable and the command line argument list for this process. 227 * Sets the executable and the command line argument list for this process.
228 * 228 *
229 * For example, doing an "ls -l /usr/local/bin" can be achieved by: 229 * For example, doing an "ls -l /usr/local/bin" can be achieved by:
230 * <pre> 230 * <pre>
231 * OProcess p; 231 * OProcess p;
232 * ... 232 * ...
233 * p << "ls" << "-l" << "/usr/local/bin" 233 * p << "ls" << "-l" << "/usr/local/bin"
234 * </pre> 234 * </pre>
235 * 235 *
236 **/ 236 **/
237 OProcess &operator<<(const QString& arg); 237 OProcess &operator<<(const QString& arg);
238 /** 238 /**
239 * Similar to previous method, takes a char *, supposed to be in locale 8 bit already. 239 * Similar to previous method, takes a char *, supposed to be in locale 8 bit already.
240 */ 240 */
241 OProcess &operator<<(const char * arg); 241 OProcess &operator<<(const char * arg);
242 /** 242 /**
243 * Similar to previous method, takes a QCString, supposed to be in locale 8 bit already. 243 * Similar to previous method, takes a QCString, supposed to be in locale 8 bit already.
244 */ 244 */
245 OProcess &operator<<(const QCString & arg); 245 OProcess &operator<<(const QCString & arg);
246 246
247 /** 247 /**
248 * Sets the executable and the command line argument list for this process, 248 * Sets the executable and the command line argument list for this process,
249 * in a single method call, or add a list of arguments. 249 * in a single method call, or add a list of arguments.
250 **/ 250 **/
251 OProcess &operator<<(const QStringList& args); 251 OProcess &operator<<(const QStringList& args);
252 252
253 /** 253 /**
254 * Clear a command line argument list that has been set by using 254 * Clear a command line argument list that has been set by using
255 * the "operator<<". 255 * the "operator<<".
256 */ 256 */
257 void clearArguments(); 257 void clearArguments();
258 258
259 /** 259 /**
260 * Starts the process. 260 * Starts the process.
261 * For a detailed description of the 261 * For a detailed description of the
262 * various run modes and communication semantics, have a look at the 262 * various run modes and communication semantics, have a look at the
263 * general description of the OProcess class. 263 * general description of the OProcess class.
264 * 264 *
265 * The following problems could cause this function to 265 * The following problems could cause this function to
266 * return false: 266 * return false:
267 * 267 *
268 * @li The process is already running. 268 * @li The process is already running.
269 * @li The command line argument list is empty. 269 * @li The command line argument list is empty.
270 * @li The starting of the process failed (could not fork). 270 * @li The starting of the process failed (could not fork).
271 * @li The executable was not found. 271 * @li The executable was not found.
272 * 272 *
273 * @param comm Specifies which communication links should be 273 * @param comm Specifies which communication links should be
274 * established to the child process (stdin/stdout/stderr). By default, 274 * established to the child process (stdin/stdout/stderr). By default,
275 * no communication takes place and the respective communication 275 * no communication takes place and the respective communication
276 * signals will never get emitted. 276 * signals will never get emitted.
277 * 277 *
278 * @return true on success, false on error 278 * @return true on success, false on error
279 * (see above for error conditions) 279 * (see above for error conditions)
280 **/ 280 **/
281 virtual bool start(RunMode runmode = NotifyOnExit, 281 virtual bool start(RunMode runmode = NotifyOnExit,
282 Communication comm = NoCommunication); 282 Communication comm = NoCommunication);
283 283
284 /** 284 /**
285 * Stop the process (by sending it a signal). 285 * Stop the process (by sending it a signal).
286 * 286 *
287 * @param signoThe signal to send. The default is SIGTERM. 287 * @param signoThe signal to send. The default is SIGTERM.
288 * @return @p true if the signal was delivered successfully. 288 * @return @p true if the signal was delivered successfully.
289 */ 289 */
290 virtual bool kill(int signo = SIGTERM); 290 virtual bool kill(int signo = SIGTERM);
291 291
292 /** 292 /**
293 @return @p true if the process is (still) considered to be running 293 @return @p true if the process is (still) considered to be running
294 */ 294 */
295 bool isRunning() const; 295 bool isRunning() const;
296 296
297 /** Returns the process id of the process. 297 /** Returns the process id of the process.
298 * 298 *
299 * If it is called after 299 * If it is called after
300 * the process has exited, it returns the process id of the last 300 * the process has exited, it returns the process id of the last
301 * child process that was created by this instance of OProcess. 301 * child process that was created by this instance of OProcess.
302 * 302 *
303 * Calling it before any child process has been started by this 303 * Calling it before any child process has been started by this
304 * OProcess instance causes pid() to return 0. 304 * OProcess instance causes pid() to return 0.
305 **/ 305 **/
306 pid_t pid() const; 306 pid_t pid() const;
307 307
308 /** 308 /**
309 * Use pid().
310 * @deprecated
311 */
312 pid_t getPid() const { return pid(); }
313
314 /**
315 * Suspend processing of data from stdout of the child process. 309 * Suspend processing of data from stdout of the child process.
316 */ 310 */
317 void suspend(); 311 void suspend();
318 312
319 /** 313 /**
320 * Resume processing of data from stdout of the child process. 314 * Resume processing of data from stdout of the child process.
321 */ 315 */
322 void resume(); 316 void resume();
323 317
324 /** 318 /**
325 * @return @p true if the process has already finished and has exited 319 * @return @p true if the process has already finished and has exited
326 * "voluntarily", ie: it has not been killed by a signal. 320 * "voluntarily", ie: it has not been killed by a signal.
327 * 321 *
328 * Note that you should check @ref OProcess::exitStatus() to determine 322 * Note that you should check @ref OProcess::exitStatus() to determine
329 * whether the process completed its task successful or not. 323 * whether the process completed its task successful or not.
330 */ 324 */
331 bool normalExit() const; 325 bool normalExit() const;
332 326
333 /** 327 /**
334 * Returns the exit status of the process. 328 * Returns the exit status of the process.
335 * 329 *
336 * Please use 330 * Please use
337 * @ref OProcess::normalExit() to check whether the process has exited 331 * @ref OProcess::normalExit() to check whether the process has exited
338 * cleanly (i.e., @ref OProcess::normalExit() returns @p true) before calling 332 * cleanly (i.e., @ref OProcess::normalExit() returns @p true) before calling
339 * this function because if the process did not exit normally, 333 * this function because if the process did not exit normally,
340 * it does not have a valid exit status. 334 * it does not have a valid exit status.
341 */ 335 */
342 int exitStatus() const; 336 int exitStatus() const;
343 337
344 338
345 /** 339 /**
346 * Transmit data to the child process's stdin. 340 * Transmit data to the child process's stdin.
347 * 341 *
348 * OProcess::writeStdin may return false in the following cases: 342 * OProcess::writeStdin may return false in the following cases:
349 * 343 *
350 * @li The process is not currently running. 344 * @li The process is not currently running.
351 * 345 *
352 * @li Communication to stdin has not been requested in the @ref start() call. 346 * @li Communication to stdin has not been requested in the @ref start() call.
353 * 347 *
354 * @li Transmission of data to the child process by a previous call to 348 * @li Transmission of data to the child process by a previous call to
355 * @ref writeStdin() is still in progress. 349 * @ref writeStdin() is still in progress.
356 * 350 *
357 * Please note that the data is sent to the client asynchronously, 351 * Please note that the data is sent to the client asynchronously,
358 * so when this function returns, the data might not have been 352 * so when this function returns, the data might not have been
359 * processed by the child process. 353 * processed by the child process.
360 * 354 *
361 * If all the data has been sent to the client, the signal 355 * If all the data has been sent to the client, the signal
362 * @ref wroteStdin() will be emitted. 356 * @ref wroteStdin() will be emitted.
363 * 357 *
364 * Please note that you must not free "buffer" or call @ref writeStdin() 358 * Please note that you must not free "buffer" or call @ref writeStdin()
365 * again until either a @ref wroteStdin() signal indicates that the 359 * again until either a @ref wroteStdin() signal indicates that the
366 * data has been sent or a @ref processHasExited() signal shows that 360 * data has been sent or a @ref processHasExited() signal shows that
367 * the child process is no longer alive... 361 * the child process is no longer alive...
368 **/ 362 **/
369 bool writeStdin(const char *buffer, int buflen); 363 bool writeStdin(const char *buffer, int buflen);
370 364
371 void flushStdin(); 365 void flushStdin();
372 366
373 /** 367 /**
374 * This causes the stdin file descriptor of the child process to be 368 * This causes the stdin file descriptor of the child process to be
375 * closed indicating an "EOF" to the child. 369 * closed indicating an "EOF" to the child.
376 * 370 *
377 * @return @p false if no communication to the process's stdin 371 * @return @p false if no communication to the process's stdin
378 * had been specified in the call to @ref start(). 372 * had been specified in the call to @ref start().
379 */ 373 */
380 bool closeStdin(); 374 bool closeStdin();
381 375
382 /** 376 /**
383 * This causes the stdout file descriptor of the child process to be 377 * This causes the stdout file descriptor of the child process to be
384 * closed. 378 * closed.
385 * 379 *
386 * @return @p false if no communication to the process's stdout 380 * @return @p false if no communication to the process's stdout
387 * had been specified in the call to @ref start(). 381 * had been specified in the call to @ref start().
388 */ 382 */
389 bool closeStdout(); 383 bool closeStdout();
390 384
391 /** 385 /**
392 * This causes the stderr file descriptor of the child process to be 386 * This causes the stderr file descriptor of the child process to be
393 * closed. 387 * closed.
394 * 388 *
395 * @return @p false if no communication to the process's stderr 389 * @return @p false if no communication to the process's stderr
396 * had been specified in the call to @ref start(). 390 * had been specified in the call to @ref start().
397 */ 391 */
398 bool closeStderr(); 392 bool closeStderr();
399 393
400 /** 394 /**
401 * Lets you see what your arguments are for debugging. 395 * Lets you see what your arguments are for debugging.
402 */ 396 */
403 397
404 const QValueList<QCString> &args() { return arguments; } 398 const QValueList<QCString> &args() { return arguments; }
405 399
406 /** 400 /**
407 * Controls whether the started process should drop any 401 * Controls whether the started process should drop any
408 * setuid/segid privileges or whether it should keep them 402 * setuid/segid privileges or whether it should keep them
409 * 403 *
410 * The default is @p false : drop privileges 404 * The default is @p false : drop privileges
411 */ 405 */
412 void setRunPrivileged(bool keepPrivileges); 406 void setRunPrivileged(bool keepPrivileges);
413 407
414 /** 408 /**
415 * Returns whether the started process will drop any 409 * Returns whether the started process will drop any
416 * setuid/segid privileges or whether it will keep them 410 * setuid/segid privileges or whether it will keep them
417 */ 411 */
418 bool runPrivileged() const; 412 bool runPrivileged() const;
419 413
420 /** 414 /**
421 * Modifies the environment of the process to be started. 415 * Modifies the environment of the process to be started.
422 * This function must be called before starting the process. 416 * This function must be called before starting the process.
423 */ 417 */
424 void setEnvironment(const QString &name, const QString &value); 418 void setEnvironment(const QString &name, const QString &value);
425 419
426 /** 420 /**
427 * Changes the current working directory (CWD) of the process 421 * Changes the current working directory (CWD) of the process
428 * to be started. 422 * to be started.
429 * This function must be called before starting the process. 423 * This function must be called before starting the process.
430 */ 424 */
431 void setWorkingDirectory(const QString &dir); 425 void setWorkingDirectory(const QString &dir);
432 426
433 /** 427 /**
434 * Specify whether to start the command via a shell or directly. 428 * Specify whether to start the command via a shell or directly.
435 * The default is to start the command directly. 429 * The default is to start the command directly.
436 * If @p useShell is true @p shell will be used as shell, or 430 * If @p useShell is true @p shell will be used as shell, or
437 * if shell is empty, the standard shell is used. 431 * if shell is empty, the standard shell is used.
438 * @p quote A flag indicating whether to quote the arguments. 432 * @p quote A flag indicating whether to quote the arguments.
439 * 433 *
440 * When using a shell, the caller should make sure that all filenames etc. 434 * When using a shell, the caller should make sure that all filenames etc.
441 * are properly quoted when passed as argument. 435 * are properly quoted when passed as argument.
442 * @see quote() 436 * @see quote()