class Command

Command is a class for running a command in another process. More...

Definition#include <sysadm/Command.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

Command is a class for running a command in another process.

 Command (const String& command)

Command ()

void  setUid (uid_t uid)

Call these before running the command to affect behavior.

void  setInput (int fd)

void  setOutput (int fd)

void  setError (int fd)

void  addArg (const String& arg)

void  setArgs (const char* const* argList)

Set the args to be passed to execv(). Command does not make a copy of these arguments; they must not be freed until after Command::run() has been called.

void  setLangC ()

Set LANG=C for command to be run; useful for commands whose output is to be parsed, rather than displayed to the user.

void  usePty ()

Use a pseudo-terminal instead of a pipe for output & error.

void  setDir (const String& dir)

Set the directory in which the command should be run.

int  run ()

Run the command. You can only run a command once. Returns 0 if successful, -1 if error.

int  getInput ()

These are only useful if the corresponding "set" methods have *not* been called. The can only be called after run();

int  getOutput ()

int  getError ()

void  closeInput ()

FILE*  getInputFP ()

FILE*  getOutputFP ()

FILE*  getErrorFP ()

void  kill (int sig = SIGTERM)

void  wait ()

Wait and get status.

int  getExitStatus ()

void  dumpError (int fd)

Copy commands error to "fd". Will not work if setError() was called.


Generated by: rusty@irem on Mon Sep 18 18:07:52 2000, using kdoc 2.0a36.